Projekt

Obecné

Profil

« Předchozí | Další » 

Revize cdeee9f8

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

Re #8955 implemented multiple predictors support

Zobrazit rozdíly:

Server/ServerApp/Predictor/FeatureExtractor.cs
13 13
    /// <summary>
14 14
    /// A class responsible for preparation of features for classifiers.
15 15
    /// </summary>
16
    public class FeatureExtractor
16
    class FeatureExtractor
17 17
    {
18 18
        /// <summary>
19 19
        /// A DataParser instance used to access info objects.
20 20
        /// </summary>
21
        private readonly IDataParser dataParser;
21
        private readonly IDataParser DataParser;
22 22

  
23
        private Dictionary<string, int> buildingsToAreas;
23
        /// <summary>
24
        /// A configuration object of the <c>Predictor</c> package
25
        /// </summary>
26
        private PredictorConfiguration Configuration;
24 27

  
25 28
        /// <summary>
26 29
        /// Instantiates new FeatureExtractor class.
27 30
        /// </summary>
28 31
        /// <param name="dataParser">Data parser used to access training data.</param>
29
        public FeatureExtractor(IDataParser dataParser, Dictionary<string, int> buildingsToAreas)
32
        public FeatureExtractor(IDataParser dataParser, PredictorConfiguration configuration)
30 33
        {
31
            this.dataParser = dataParser;
32
            this.buildingsToAreas = buildingsToAreas;
34
            this.DataParser = dataParser;
35
            this.Configuration = configuration;
33 36
        }
34 37

  
35 38
        /// <summary>
......
41 44
        /// <param name="interval"></param>
42 45
        /// <param name="wholeDay"></param>
43 46
        /// <returns></returns>
44
        public List<ModelInput> PrepareTrainingInput(int area, DateTime startDate, DateTime endDate, int interval = 1, bool wholeDay = true)
47
        public List<ModelInput> PrepareTrainingInput(int area, DateTime startDate, DateTime endDate, int interval = 3, bool wholeDay = true)
45 48
        {
46
            dataParser.Parse(startDate, endDate, interval, wholeDay);
49
            DataParser.Parse(startDate, endDate, interval, wholeDay);
47 50
            List<string> buildings = new List<string>();
48 51

  
49 52
            // find all buildings in area
50
            foreach (KeyValuePair<string, int> kvp in buildingsToAreas)
53
            foreach (KeyValuePair<string, int> kvp in Configuration.BuildingsToAreas)
51 54
            {
52 55
                if (kvp.Value == area)
53 56
                {
......
56 59
            }
57 60

  
58 61
            var res = new List<ModelInput>();
59
            foreach (WeatherInfo val in dataParser.WeatherList)
62
            foreach (WeatherInfo val in DataParser.WeatherList)
60 63
            {
61 64
                res.Add(new ModelInput
62 65
                {
......
68 71
                });
69 72
            }
70 73

  
71
            List<ActivityInfo> attendance = dataParser.AttendanceList;
74
            List<ActivityInfo> attendance = DataParser.AttendanceList;
72 75
            foreach (ModelInput input in res)
73 76
            {
74 77
                List<int> amounts = new List<int>();

Také k dispozici: Unified diff