Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d358b79e

Přidáno uživatelem Roman Kalivoda před téměř 4 roky(ů)

Re #8832 Label creation

Zobrazit rozdíly:

Server/ServerApp/Predictor/PredictionController.cs
6 6
using System.Collections.Generic;
7 7
using System.IO;
8 8
using Microsoft.ML;
9
using ServerApp.Connection.XMLProtocolHandler;
9 10
using ServerApp.Parser.OutputInfo;
10 11
using ServerApp.Parser.Parsers;
11 12

  
......
71 72
            }
72 73
        }
73 74

  
74
        public IDataView Predict(string locationKey, WeatherInfo weather, DateTime dateTime)
75
        public Response Predict(Request request)
75 76
        {
76
            IEnumerable<ModelInput> data = new List<ModelInput>
77
            {
78
                new ModelInput
79
                {
80
                    Temp = (float)weather.temp,
81
                }
82
            };
83
            return this.predictors[buildingsToAreas[locationKey]].Predict(data);
77
            throw new NotImplementedException();
84 78
        }
85 79

  
86 80

  
......
93 87
                for (int i = 0; i < this.predictors.Count; i++)
94 88
                {
95 89
                    // train on all available data
96
                    IEnumerable<ModelInput> data = featureExtractor.PrepareModelInput(i, DateTime.MinValue, DateTime.MaxValue);
97
                    this.predictors[i].Fit(data);
90
                    // TODO the train/test split is used just temporarily for demonstration.
91
                    List<ModelInput> data = featureExtractor.PrepareTrainingInput(i, DateTime.MinValue, DateTime.MaxValue);
92
                    List<ModelInput> trainingData = data.GetRange(index: 0, count: 500);
93
                    List<ModelInput> testData = data.GetRange(index: 500, count: 94);
94
                    Console.WriteLine("Training predictor with {0} samples.", trainingData.Count);
95
                    this.predictors[i].Fit(trainingData);
96

  
97
                    Console.WriteLine("Evaluating predictor with {0} samples.", testData.Count);
98
                    this.predictors[i].Evaluate(testData);
98 99
                }
99 100
            } else
100 101
            // train specified predictor only

Také k dispozici: Unified diff