1 |
ebe96ca4
|
Roman Kalivoda
|
//
|
2 |
|
|
// Author: Roman Kalivoda
|
3 |
|
|
//
|
4 |
|
|
|
5 |
|
|
using System;
|
6 |
|
|
using System.Collections.Generic;
|
7 |
d358b79e
|
Roman Kalivoda
|
using ServerApp.Connection.XMLProtocolHandler;
|
8 |
ce0940b5
|
Roman Kalivoda
|
using ServerApp.Parser.Parsers;
|
9 |
|
|
using Newtonsoft.Json;
|
10 |
|
|
using ServerApp.WeatherPredictionParser;
|
11 |
870cd163
|
Roman Kalivoda
|
using ServerApp.Parser.OutputInfo;
|
12 |
0d31f7e0
|
Roman Kalivoda
|
using log4net;
|
13 |
0e7b6b11
|
Roman Kalivoda
|
using System.IO;
|
14 |
|
|
using System.Text.RegularExpressions;
|
15 |
|
|
using System.Linq;
|
16 |
ebe96ca4
|
Roman Kalivoda
|
|
17 |
|
|
namespace ServerApp.Predictor
|
18 |
|
|
{
|
19 |
|
|
/// <summary>
|
20 |
|
|
/// Implentation of the <c>IPredicitionController</c> interface.
|
21 |
|
|
/// </summary>
|
22 |
ce0940b5
|
Roman Kalivoda
|
public class PredictionController : IPredictionController
|
23 |
ebe96ca4
|
Roman Kalivoda
|
{
|
24 |
0d31f7e0
|
Roman Kalivoda
|
private static readonly ILog _log = LogManager.GetLogger(typeof(PredictionController));
|
25 |
|
|
|
26 |
0e7b6b11
|
Roman Kalivoda
|
/// <summary>
|
27 |
|
|
/// ID of the current predictor instances.
|
28 |
|
|
/// </summary>
|
29 |
|
|
private string PredictorID;
|
30 |
|
|
|
31 |
ebe96ca4
|
Roman Kalivoda
|
/// <summary>
|
32 |
ce0940b5
|
Roman Kalivoda
|
/// Configuration of the <c>Predictor</c>
|
33 |
ebe96ca4
|
Roman Kalivoda
|
/// </summary>
|
34 |
0e7b6b11
|
Roman Kalivoda
|
public PredictorConfiguration Configuration { get; set; }
|
35 |
|
|
|
36 |
|
|
/// <summary>
|
37 |
|
|
/// Names of the files used to train the current predictor instances.
|
38 |
|
|
/// </summary>
|
39 |
|
|
private IEnumerable<string> DataFilenames;
|
40 |
ebe96ca4
|
Roman Kalivoda
|
|
41 |
0e7b6b11
|
Roman Kalivoda
|
/// <summary>
|
42 |
|
|
/// Current predictor instances
|
43 |
|
|
/// </summary>
|
44 |
|
|
private IPredictor[] Predictors;
|
45 |
ebe96ca4
|
Roman Kalivoda
|
|
46 |
6dc585b4
|
Roman Kalivoda
|
/// <summary>
|
47 |
|
|
/// A mutual exclusive lock to pro
|
48 |
|
|
/// </summary>
|
49 |
|
|
private readonly object predictorsLock = new Object();
|
50 |
|
|
|
51 |
ebe96ca4
|
Roman Kalivoda
|
/// <summary>
|
52 |
|
|
/// A reference to a data parser.
|
53 |
|
|
/// </summary>
|
54 |
ce0940b5
|
Roman Kalivoda
|
private IDataParser DataParser;
|
55 |
ebe96ca4
|
Roman Kalivoda
|
|
56 |
|
|
/// <summary>
|
57 |
|
|
/// A feature extractor instance.
|
58 |
|
|
/// </summary>
|
59 |
ce0940b5
|
Roman Kalivoda
|
private FeatureExtractor FeatureExtractor;
|
60 |
|
|
|
61 |
|
|
/// <summary>
|
62 |
|
|
/// A weather prediction parser service
|
63 |
|
|
/// </summary>
|
64 |
|
|
private IJsonParser weatherService;
|
65 |
870cd163
|
Roman Kalivoda
|
|
66 |
ebe96ca4
|
Roman Kalivoda
|
/// <summary>
|
67 |
|
|
/// Instantiates new prediction controller.
|
68 |
|
|
/// </summary>
|
69 |
|
|
/// <param name="dataParser">A data parser used to get training data.</param>
|
70 |
ce0940b5
|
Roman Kalivoda
|
public PredictionController(IJsonParser weatherService, IDataParser dataParser, string pathToConfig = null)
|
71 |
ebe96ca4
|
Roman Kalivoda
|
{
|
72 |
0d31f7e0
|
Roman Kalivoda
|
_log.Info("Constructing a new PredictionController instance.");
|
73 |
870cd163
|
Roman Kalivoda
|
this.weatherService = weatherService;
|
74 |
cdeee9f8
|
Roman Kalivoda
|
// load config or get the default one
|
75 |
|
|
if (pathToConfig is null)
|
76 |
|
|
{
|
77 |
|
|
pathToConfig = PredictorConfiguration.DEFAULT_CONFIG_PATH;
|
78 |
|
|
}
|
79 |
|
|
try
|
80 |
|
|
{
|
81 |
0e7b6b11
|
Roman Kalivoda
|
string json = File.ReadAllText(pathToConfig);
|
82 |
cdeee9f8
|
Roman Kalivoda
|
this.Configuration = JsonConvert.DeserializeObject<PredictorConfiguration>(json);
|
83 |
0d31f7e0
|
Roman Kalivoda
|
}
|
84 |
3c4b53fe
|
Roman Kalivoda
|
catch (System.IO.FileNotFoundException e)
|
85 |
cdeee9f8
|
Roman Kalivoda
|
{
|
86 |
29a3f064
|
Roman Kalivoda
|
Console.WriteLine("Warning: could not find a configuration file, creating a new one:");
|
87 |
|
|
Console.WriteLine(e.Message.PadLeft(4));
|
88 |
cdeee9f8
|
Roman Kalivoda
|
this.Configuration = PredictorConfiguration.GetDefaultConfig();
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
this.DataParser = dataParser;
|
92 |
6dc585b4
|
Roman Kalivoda
|
var predictors = new IPredictor[this.Configuration.PredictorCount];
|
93 |
cdeee9f8
|
Roman Kalivoda
|
this.FeatureExtractor = new FeatureExtractor(this.DataParser, this.Configuration);
|
94 |
22211075
|
Roman Kalivoda
|
|
95 |
3c4b53fe
|
Roman Kalivoda
|
DirectoryInfo di = new DirectoryInfo(Configuration.ModelDataPath);
|
96 |
76072df0
|
Roman Kalivoda
|
_log.Debug($"Looking for directory: {Configuration.ModelDataPath}");
|
97 |
|
|
if (! di.Exists)
|
98 |
|
|
{
|
99 |
|
|
_log.Info($"Creating the model data directory: {Configuration.ModelDataPath}");
|
100 |
|
|
di.Create();
|
101 |
|
|
}
|
102 |
3c4b53fe
|
Roman Kalivoda
|
FileInfo[] files = di.GetFiles();
|
103 |
9a529f10
|
Roman Kalivoda
|
var orderedEnumerable = Array.FindAll(files, f => Regex.IsMatch(f.Name, @"[-]?\d+_\d+.zip")).GroupBy(f => f.Name.Split("_.".ToCharArray())[0]).OrderBy(f => DateTime.FromBinary(Convert.ToInt64(f.Key)));
|
104 |
|
|
if (orderedEnumerable.Where(g => g.Count() == Configuration.PredictorCount).Any())
|
105 |
ebe96ca4
|
Roman Kalivoda
|
{
|
106 |
3c4b53fe
|
Roman Kalivoda
|
_log.Info("Found existing predictors, loading the newest.");
|
107 |
9a529f10
|
Roman Kalivoda
|
var predictorID = orderedEnumerable.Last().Select(f => f.Name.Split("_".ToCharArray())[0]).First();
|
108 |
76072df0
|
Roman Kalivoda
|
this.Load(predictorID);
|
109 |
3c4b53fe
|
Roman Kalivoda
|
}
|
110 |
|
|
else
|
111 |
|
|
{
|
112 |
|
|
_log.Info("No predictors found, creating new ones");
|
113 |
|
|
for (int i = 0; i < this.Configuration.PredictorCount; i++)
|
114 |
|
|
{
|
115 |
76072df0
|
Roman Kalivoda
|
predictors[i] = new SdcaMaximumEntropyClassifier();
|
116 |
|
|
}
|
117 |
|
|
lock (predictorsLock)
|
118 |
|
|
{
|
119 |
|
|
this.Predictors = predictors;
|
120 |
3c4b53fe
|
Roman Kalivoda
|
}
|
121 |
8f8d8aa7
|
Roman Kalivoda
|
this.Train();
|
122 |
ebe96ca4
|
Roman Kalivoda
|
}
|
123 |
76072df0
|
Roman Kalivoda
|
|
124 |
ce0940b5
|
Roman Kalivoda
|
PredictorConfiguration.SaveConfig(PredictorConfiguration.DEFAULT_CONFIG_PATH, Configuration);
|
125 |
ebe96ca4
|
Roman Kalivoda
|
}
|
126 |
|
|
public List<string> GetPredictors()
|
127 |
|
|
{
|
128 |
ce0940b5
|
Roman Kalivoda
|
return new List<string>(this.Configuration.BuildingsToAreas.Keys);
|
129 |
ebe96ca4
|
Roman Kalivoda
|
}
|
130 |
|
|
|
131 |
3c4b53fe
|
Roman Kalivoda
|
public int Load(string predictorID)
|
132 |
ebe96ca4
|
Roman Kalivoda
|
{
|
133 |
76072df0
|
Roman Kalivoda
|
DirectoryInfo di = new DirectoryInfo(Configuration.ModelDataPath);
|
134 |
|
|
if (!di.Exists)
|
135 |
|
|
{
|
136 |
|
|
_log.Warn("The model data directory could not be found.");
|
137 |
|
|
return 2;
|
138 |
|
|
}
|
139 |
0e7b6b11
|
Roman Kalivoda
|
FileInfo[] files = di.GetFiles($"{predictorID}_*.zip");
|
140 |
3c4b53fe
|
Roman Kalivoda
|
if (Array.FindAll(files, f => Regex.IsMatch(f.Name, $@"{predictorID}_\d+.zip")).Any()){
|
141 |
|
|
IPredictor[] newPredictors = new IPredictor[this.Configuration.PredictorCount];
|
142 |
|
|
try
|
143 |
|
|
{
|
144 |
|
|
for (int i = 0; i < this.Configuration.PredictorCount; i++)
|
145 |
|
|
{
|
146 |
76072df0
|
Roman Kalivoda
|
newPredictors[i] = new SdcaMaximumEntropyClassifier(Array.Find(files, f => Regex.IsMatch(f.Name, $"{predictorID}_{i}.zip")).FullName);
|
147 |
3c4b53fe
|
Roman Kalivoda
|
}
|
148 |
|
|
files = di.GetFiles($"{predictorID}.txt");
|
149 |
6dc585b4
|
Roman Kalivoda
|
var dataFilenames = File.ReadLines(files[0].FullName);
|
150 |
|
|
lock (predictorsLock)
|
151 |
|
|
{
|
152 |
|
|
this.Predictors = newPredictors;
|
153 |
|
|
this.DataFilenames = dataFilenames;
|
154 |
|
|
this.PredictorID = predictorID;
|
155 |
|
|
}
|
156 |
3c4b53fe
|
Roman Kalivoda
|
} catch (FileNotFoundException e)
|
157 |
|
|
{
|
158 |
|
|
_log.Error(e.ToString());
|
159 |
|
|
return 2;
|
160 |
|
|
}
|
161 |
|
|
} else
|
162 |
|
|
{
|
163 |
|
|
_log.Debug("Could not find predictor with given predictorID");
|
164 |
|
|
return 1;
|
165 |
|
|
}
|
166 |
|
|
return 0;
|
167 |
|
|
}
|
168 |
|
|
|
169 |
|
|
public void Save()
|
170 |
|
|
{
|
171 |
|
|
DirectoryInfo di = new DirectoryInfo(Configuration.ModelDataPath);
|
172 |
76072df0
|
Roman Kalivoda
|
if (!di.Exists)
|
173 |
|
|
{
|
174 |
|
|
_log.Warn("The model data directory could not be found.");
|
175 |
|
|
return;
|
176 |
|
|
}
|
177 |
3c4b53fe
|
Roman Kalivoda
|
|
178 |
6dc585b4
|
Roman Kalivoda
|
lock (predictorsLock)
|
179 |
ebe96ca4
|
Roman Kalivoda
|
{
|
180 |
6dc585b4
|
Roman Kalivoda
|
for (int i = 0; i < this.Configuration.PredictorCount; i++)
|
181 |
|
|
{
|
182 |
|
|
Predictors[i].Save(Path.Combine(di.FullName, $"{PredictorID}_{i}.zip"));
|
183 |
|
|
}
|
184 |
|
|
File.WriteAllLinesAsync(Path.Combine(di.FullName, $"{PredictorID}.txt"), this.DataFilenames);
|
185 |
ebe96ca4
|
Roman Kalivoda
|
}
|
186 |
0e7b6b11
|
Roman Kalivoda
|
}
|
187 |
|
|
|
188 |
3c4b53fe
|
Roman Kalivoda
|
public int Rollback()
|
189 |
0e7b6b11
|
Roman Kalivoda
|
{
|
190 |
3c4b53fe
|
Roman Kalivoda
|
DirectoryInfo di = new DirectoryInfo(Configuration.ModelDataPath);
|
191 |
76072df0
|
Roman Kalivoda
|
if (!di.Exists)
|
192 |
|
|
{
|
193 |
|
|
_log.Warn("The model data directory could not be found.");
|
194 |
|
|
return 2;
|
195 |
|
|
}
|
196 |
3c4b53fe
|
Roman Kalivoda
|
FileInfo[] files = di.GetFiles();
|
197 |
9a529f10
|
Roman Kalivoda
|
var orderedEnumerable = Array.FindAll(files, f => Regex.IsMatch(f.Name, @"[-]?\d+_\d+.zip")).GroupBy(f => f.Name.Split("_.".ToCharArray())[0]).OrderBy(f => DateTime.FromBinary(Convert.ToInt64(f.Key))).Where(f => ! f.Key.Equals(this.PredictorID));
|
198 |
|
|
if (orderedEnumerable.Where(g => g.Count() == Configuration.PredictorCount).Any())
|
199 |
3c4b53fe
|
Roman Kalivoda
|
{
|
200 |
9a529f10
|
Roman Kalivoda
|
string RollbackedPredictorID = orderedEnumerable.Last().Select(f => f.Name.Split("_".ToCharArray())[0]).First();
|
201 |
3c4b53fe
|
Roman Kalivoda
|
this.Delete(this.PredictorID);
|
202 |
|
|
return this.Load(RollbackedPredictorID);
|
203 |
|
|
} else
|
204 |
|
|
{
|
205 |
|
|
// indicate that older model does not exist
|
206 |
|
|
return 1;
|
207 |
|
|
}
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
private void Delete(string predictorID)
|
211 |
|
|
{
|
212 |
|
|
DirectoryInfo di = new DirectoryInfo(Configuration.ModelDataPath);
|
213 |
76072df0
|
Roman Kalivoda
|
if (!di.Exists)
|
214 |
|
|
{
|
215 |
|
|
_log.Warn("The model data directory could not be found.");
|
216 |
|
|
return;
|
217 |
|
|
}
|
218 |
0e7b6b11
|
Roman Kalivoda
|
|
219 |
3c4b53fe
|
Roman Kalivoda
|
for (int i = 0; i < this.Configuration.PredictorCount; i++)
|
220 |
|
|
{
|
221 |
|
|
File.Delete(Path.Combine(di.FullName, $"{PredictorID}_{i}.zip"));
|
222 |
|
|
}
|
223 |
|
|
File.Delete(Path.Combine(di.FullName, $"{PredictorID}.txt"));
|
224 |
ebe96ca4
|
Roman Kalivoda
|
}
|
225 |
|
|
|
226 |
d358b79e
|
Roman Kalivoda
|
public Response Predict(Request request)
|
227 |
ebe96ca4
|
Roman Kalivoda
|
{
|
228 |
0d31f7e0
|
Roman Kalivoda
|
_log.Info($"Received a prediction request: endDate={request.useEndDate}, weather={request.useWeather}");
|
229 |
870cd163
|
Roman Kalivoda
|
DateTime start = new DateTime(year: request.start.year, month: request.start.month, day: request.start.day, hour: request.start.hour, minute: 0, second: 0);
|
230 |
|
|
List<Prediction> predictions = new List<Prediction>();
|
231 |
|
|
if (request.useEndDate)
|
232 |
|
|
{
|
233 |
|
|
DateTime end = new DateTime(year: request.end.year, month: request.end.month, day: request.end.day, hour: request.end.hour, minute: 0, second: 0);
|
234 |
|
|
DateTime current = start;
|
235 |
9a529f10
|
Roman Kalivoda
|
while (current <= end)
|
236 |
870cd163
|
Roman Kalivoda
|
{
|
237 |
0d31f7e0
|
Roman Kalivoda
|
_log.Debug($"Predicting for date {current.Date.ToShortDateString()}");
|
238 |
9a529f10
|
Roman Kalivoda
|
while (current.Hour <= Date.MAX_HOUR)
|
239 |
870cd163
|
Roman Kalivoda
|
{
|
240 |
9a529f10
|
Roman Kalivoda
|
if (current.Date == end.Date && current.Hour > end.Hour)
|
241 |
|
|
{
|
242 |
|
|
break; // break if the end date was reached and hour is after the end time.
|
243 |
|
|
}
|
244 |
0d31f7e0
|
Roman Kalivoda
|
_log.Debug($"Predicting for time {current.TimeOfDay.ToString()}");
|
245 |
870cd163
|
Roman Kalivoda
|
var prediction = PredictSingle(request, current);
|
246 |
|
|
predictions.Add(prediction);
|
247 |
|
|
current = current.AddHours(this.Configuration.TimeResolution);
|
248 |
|
|
}
|
249 |
|
|
current = current.AddHours(23 - current.Hour + Date.MIN_HOUR);
|
250 |
|
|
}
|
251 |
0d31f7e0
|
Roman Kalivoda
|
}
|
252 |
|
|
else
|
253 |
870cd163
|
Roman Kalivoda
|
{
|
254 |
0d31f7e0
|
Roman Kalivoda
|
_log.Debug("Predicting for single DateTime.");
|
255 |
|
|
predictions.Add(PredictSingle(request, start));
|
256 |
870cd163
|
Roman Kalivoda
|
}
|
257 |
|
|
var response = new Response();
|
258 |
|
|
response.hoursPerSegment = Configuration.TimeResolution;
|
259 |
|
|
response.predicitons = predictions.ToArray();
|
260 |
0d31f7e0
|
Roman Kalivoda
|
_log.Debug($"Created a response.");
|
261 |
870cd163
|
Roman Kalivoda
|
return response;
|
262 |
ebe96ca4
|
Roman Kalivoda
|
}
|
263 |
|
|
|
264 |
0060a0ae
|
Roman Kalivoda
|
private Prediction PredictSingle(Request request, DateTime predictionTime)
|
265 |
870cd163
|
Roman Kalivoda
|
{
|
266 |
|
|
double[] predictedValues = new double[this.Configuration.BuildingsToAreas.Count];
|
267 |
0e7b6b11
|
Roman Kalivoda
|
string[] predictedLabels = new string[this.Predictors.Length];
|
268 |
|
|
for (int i = 0; i < this.Predictors.Length; i++)
|
269 |
870cd163
|
Roman Kalivoda
|
{
|
270 |
|
|
if (request.useWeather)
|
271 |
|
|
{
|
272 |
0d31f7e0
|
Roman Kalivoda
|
_log.Debug("Predicting for requested weather.");
|
273 |
6dc585b4
|
Roman Kalivoda
|
lock (predictorsLock)
|
274 |
870cd163
|
Roman Kalivoda
|
{
|
275 |
6dc585b4
|
Roman Kalivoda
|
predictedLabels[i] = this.Predictors[i].Predict(new ModelInput
|
276 |
|
|
{
|
277 |
|
|
Rain = (float)request.rain,
|
278 |
|
|
Temp = (float)request.temperature,
|
279 |
|
|
Wind = (float)request.wind,
|
280 |
|
|
Hour = predictionTime.Hour,
|
281 |
|
|
Time = predictionTime
|
282 |
|
|
});
|
283 |
|
|
}
|
284 |
870cd163
|
Roman Kalivoda
|
}
|
285 |
|
|
else
|
286 |
|
|
{
|
287 |
0d31f7e0
|
Roman Kalivoda
|
_log.Debug("Retrieving weather info from the weather service.");
|
288 |
|
|
weatherService.ParsePrediction();
|
289 |
0060a0ae
|
Roman Kalivoda
|
WeatherInfo weatherInfo = weatherService.Predictions.Find(info => info.startTime.Date.Equals(predictionTime.Date) && predictionTime.TimeOfDay.Subtract(info.startTime.TimeOfDay).Hours < info.intervalLength);
|
290 |
1f1235a8
|
Roman Kalivoda
|
if (weatherInfo is null)
|
291 |
870cd163
|
Roman Kalivoda
|
{
|
292 |
1f1235a8
|
Roman Kalivoda
|
predictedLabels[i] = null;
|
293 |
|
|
}
|
294 |
|
|
else
|
295 |
|
|
{
|
296 |
6dc585b4
|
Roman Kalivoda
|
lock (predictorsLock)
|
297 |
1f1235a8
|
Roman Kalivoda
|
{
|
298 |
6dc585b4
|
Roman Kalivoda
|
predictedLabels[i] = this.Predictors[i].Predict(new ModelInput
|
299 |
|
|
{
|
300 |
|
|
Rain = weatherInfo.rain,
|
301 |
|
|
Temp = (float)weatherInfo.temp,
|
302 |
|
|
Wind = (float)weatherInfo.wind,
|
303 |
|
|
Hour = predictionTime.Hour,
|
304 |
|
|
Time = predictionTime
|
305 |
|
|
});
|
306 |
|
|
}
|
307 |
1f1235a8
|
Roman Kalivoda
|
}
|
308 |
870cd163
|
Roman Kalivoda
|
}
|
309 |
|
|
}
|
310 |
|
|
for (int i = 0; i < predictedValues.Length; i++)
|
311 |
|
|
{
|
312 |
1f1235a8
|
Roman Kalivoda
|
predictedValues[i] = this.FeatureExtractor.LabelToRatio(predictedLabels[this.Configuration.BuildingsToAreas[TagInfo.buildings[i]]]);
|
313 |
870cd163
|
Roman Kalivoda
|
}
|
314 |
|
|
|
315 |
|
|
Prediction prediction = new Prediction();
|
316 |
|
|
prediction.dateTime = new Date
|
317 |
|
|
{
|
318 |
0060a0ae
|
Roman Kalivoda
|
year = predictionTime.Year,
|
319 |
|
|
month = predictionTime.Month,
|
320 |
|
|
day = predictionTime.Day,
|
321 |
|
|
hour = predictionTime.Hour
|
322 |
870cd163
|
Roman Kalivoda
|
};
|
323 |
|
|
prediction.predictions = predictedValues;
|
324 |
0d31f7e0
|
Roman Kalivoda
|
_log.Debug($"Created prediction for DateTime: {prediction.dateTime}");
|
325 |
870cd163
|
Roman Kalivoda
|
return prediction;
|
326 |
|
|
}
|
327 |
ebe96ca4
|
Roman Kalivoda
|
|
328 |
0e7b6b11
|
Roman Kalivoda
|
public void Train()
|
329 |
ebe96ca4
|
Roman Kalivoda
|
{
|
330 |
0e7b6b11
|
Roman Kalivoda
|
DataParser.Parse(DateTime.MinValue, DateTime.MaxValue, this.Configuration.TimeResolution, wholeDay: false);
|
331 |
6dc585b4
|
Roman Kalivoda
|
for (int i = 0; i < this.Configuration.PredictorCount; i++)
|
332 |
3c4b53fe
|
Roman Kalivoda
|
{
|
333 |
|
|
// train on all available data
|
334 |
|
|
List<ModelInput> data = FeatureExtractor.PrepareTrainingInput(i);
|
335 |
|
|
Console.WriteLine("Training predictor with {0} samples.", data.Count);
|
336 |
6dc585b4
|
Roman Kalivoda
|
lock (predictorsLock)
|
337 |
|
|
{
|
338 |
|
|
this.Predictors[i].Fit(data);
|
339 |
|
|
}
|
340 |
|
|
}
|
341 |
|
|
lock (predictorsLock)
|
342 |
|
|
{
|
343 |
|
|
this.DataFilenames = this.DataParser.WeatherDataUsed.Concat(this.DataParser.ActivityDataUsed);
|
344 |
|
|
this.PredictorID = DateTime.Now.ToBinary().ToString();
|
345 |
3c4b53fe
|
Roman Kalivoda
|
}
|
346 |
|
|
this.Save();
|
347 |
ebe96ca4
|
Roman Kalivoda
|
}
|
348 |
|
|
|
349 |
0e7b6b11
|
Roman Kalivoda
|
public IEnumerable<string> GetDataFileNames()
|
350 |
|
|
{
|
351 |
|
|
return this.DataFilenames;
|
352 |
|
|
}
|
353 |
ebe96ca4
|
Roman Kalivoda
|
}
|
354 |
|
|
}
|