commit 66c3e0df7538b71ded04c2932fdffd30ef60a03e
Author: Roman Kalivoda <kalivodaroman@gmail.com>
Date:   Sun Apr 18 19:27:31 2021 +0200

    re #8598
    
    Update Server/ServerApp/ServerApp.csproj
    fixed corrupted dependencies
    working simple classification

diff --git a/Server/ServerApp/Predictor/IPredictor.cs b/Server/ServerApp/Predictor/IPredictor.cs
index ed7968d..6bce4ae 100644
--- a/Server/ServerApp/Predictor/IPredictor.cs
+++ b/Server/ServerApp/Predictor/IPredictor.cs
@@ -13,6 +13,6 @@ namespace ServerApp.Predictor
 
         void Fit(IEnumerable<ModelInput> trainInput);
 
-        ModelOutput Predict(IEnumerable<ModelInput> input);
+        String[] Predict(IEnumerable<ModelInput> input);
     }
 }
diff --git a/Server/ServerApp/Predictor/ModelInput.cs b/Server/ServerApp/Predictor/ModelInput.cs
index fcb2e69..66c3190 100644
--- a/Server/ServerApp/Predictor/ModelInput.cs
+++ b/Server/ServerApp/Predictor/ModelInput.cs
@@ -4,12 +4,12 @@ namespace ServerApp.Predictor
 {
     public class ModelInput
     {
-        [ColumnName("label"), LoadColumn(0)]
-        public string LabelCol { get; set; }
+        [ColumnName("Label"), LoadColumn(0)]
+        public string Label { get; set; }
 
 
         [ColumnName("temp"), LoadColumn(1)]
-        public double Col1 { get; set; }
+        public float Temp { get; set; }
 
         //[ColumnName("date"), LoadColumn(2)]
         //public string Col2 { get; set; }
diff --git a/Server/ServerApp/Predictor/ModelOutput.cs b/Server/ServerApp/Predictor/ModelOutput.cs
index 83983cd..ad0783b 100644
--- a/Server/ServerApp/Predictor/ModelOutput.cs
+++ b/Server/ServerApp/Predictor/ModelOutput.cs
@@ -5,7 +5,7 @@ namespace ServerApp.Predictor
 {
     public class ModelOutput
     {
-        [ColumnName("PredictedLabel")]
+        [ColumnName("prediction")]
         public String Prediction { get; set; }
         public float[] Score { get; set; }
 
diff --git a/Server/ServerApp/Predictor/NaiveBayesClassifier.cs b/Server/ServerApp/Predictor/NaiveBayesClassifier.cs
index 60ff81e..a7648a2 100644
--- a/Server/ServerApp/Predictor/NaiveBayesClassifier.cs
+++ b/Server/ServerApp/Predictor/NaiveBayesClassifier.cs
@@ -24,30 +24,32 @@ namespace ServerApp.Predictor
         public IEnumerable<ModelInput> ExtractModelInput(List<WeatherInfo> weatherInfos, List<ActivityInfo> activityInfos)
         {
             return weatherInfos.Select(e => new ModelInput(){
-                Col1 = e.temp,
-                LabelCol = "Empty",
+                Temp = (float)e.temp,
+                Label = e.temp > 15.0 ? "Full" : "Empty",
             }).ToList();
         }
 
         public void Fit(IEnumerable<ModelInput> trainingData)
         {
             IDataView trainingDataView = mlContext.Data.LoadFromEnumerable(trainingData);
-            var dataProcessPipeline = mlContext.Transforms.Conversion.MapValueToKey("label", "label")
-                .Append(mlContext.Transforms.CopyColumns("Features", "temp"))
-                .Append(mlContext.Transforms.NormalizeMinMax("Features", "Features"));
+            var dataProcessPipeline = mlContext.Transforms.Conversion.MapValueToKey(nameof(ModelInput.Label))
+                .Append(mlContext.Transforms.Concatenate("Features", new[] { "temp" })
+                .Append(mlContext.Transforms.NormalizeMinMax("Features", "Features")));
             var trainer = mlContext.MulticlassClassification.Trainers.NaiveBayes();
-            var traininingPipeline = dataProcessPipeline.Append(trainer);
+            var traininingPipeline = dataProcessPipeline.Append(trainer)
+                .Append(mlContext.Transforms.Conversion.MapKeyToValue("prediction", "PredictedLabel"));
 
             this.model = traininingPipeline.Fit(trainingDataView);
 
         }
 
-        public ModelOutput Predict(IEnumerable<ModelInput> input)
+        public String[] Predict(IEnumerable<ModelInput> input)
         {
             var data = mlContext.Data.LoadFromEnumerable(input);
-            var prediction = model.Transform(data);
-            var result = mlContext.Data.CreateEnumerable<ModelOutput>(prediction, reuseRowObject: false);
-            return (ModelOutput)result;
+            IDataView result = model.Transform(data);
+            String[] prediction = result.GetColumn<String>("prediction").ToArray();
+
+            return prediction;
         }
     }
 }
diff --git a/Server/ServerApp/Program.cs b/Server/ServerApp/Program.cs
index 13c2ac8..d333b89 100644
--- a/Server/ServerApp/Program.cs
+++ b/Server/ServerApp/Program.cs
@@ -16,15 +16,20 @@ namespace ServerApp
             NaiveBayesClassifier naiveBayesClassifier = new NaiveBayesClassifier();
             IEnumerable<ModelInput> modelInput = naiveBayesClassifier.ExtractModelInput(p.weatherList, p.jisList);
             naiveBayesClassifier.Fit(modelInput);
-            var testData = new ModelInput()
+            List<ModelInput> dataList = new List<ModelInput>()
             {
-                Col1 = -40,
+                new ModelInput()
+                {
+                    Temp = -40,
+                }
             };
-            List<ModelInput> dataList = new List<ModelInput>();
-            dataList.Add(testData);
             var result = naiveBayesClassifier.Predict(dataList);
 
-            Console.WriteLine($"Prediction: {result.Prediction}");
+            Console.WriteLine($"Predictions: ");
+            foreach(var item in result)
+            {
+                Console.WriteLine(item.ToString());
+            }
 
             Console.ReadLine();
         }
diff --git a/Server/ServerApp/ServerApp.csproj b/Server/ServerApp/ServerApp.csproj
index a37967d..d8cc618 100644
--- a/Server/ServerApp/ServerApp.csproj
+++ b/Server/ServerApp/ServerApp.csproj
@@ -45,7 +45,7 @@
     <LangVersion>7.3</LangVersion>
     <ErrorReport>prompt</ErrorReport>
     <Prefer32Bit>true</Prefer32Bit>
-	<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
+    <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
     <OutputPath>bin\x64\Release\</OutputPath>
@@ -57,37 +57,10 @@
     <ErrorReport>prompt</ErrorReport>
     <Prefer32Bit>true</Prefer32Bit>
   </PropertyGroup>
+  <PropertyGroup>
+    <StartupObject>ServerApp.Program</StartupObject>
+  </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Microsoft.ML, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.1.5.5\lib\netstandard2.0\Microsoft.ML.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.1.5.5\lib\netstandard2.0\Microsoft.ML.Core.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.CpuMath, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.CpuMath.1.5.5\lib\netstandard2.0\Microsoft.ML.CpuMath.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.1.5.5\lib\netstandard2.0\Microsoft.ML.Data.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.DataView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.DataView.1.5.5\lib\netstandard2.0\Microsoft.ML.DataView.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.KMeansClustering, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.1.5.5\lib\netstandard2.0\Microsoft.ML.KMeansClustering.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.PCA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.1.5.5\lib\netstandard2.0\Microsoft.ML.PCA.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.StandardTrainers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.1.5.5\lib\netstandard2.0\Microsoft.ML.StandardTrainers.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.ML.Transforms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.ML.1.5.5\lib\netstandard2.0\Microsoft.ML.Transforms.dll</HintPath>
-    </Reference>
-    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
@@ -175,7 +148,14 @@
     </None>
     <None Include="packages.config" />
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <PackageReference Include="Microsoft.ML">
+      <Version>1.5.2</Version>
+    </PackageReference>
+    <PackageReference Include="System.Runtime.CompilerServices.Unsafe">
+      <Version>5.0.0</Version>
+    </PackageReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
