]> AND Private Git Repository - predictops.git/blobdiff - predictops/engine.py
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Reducing the computation time and adding holidays features
[predictops.git] / predictops / engine.py
index f87e82e833fbd87bcc091f4dc568108a9bf86a21..e7bbf1c5aa58221da7a8aaa71788cf0339258cbc 100644 (file)
@@ -6,6 +6,7 @@ from pathlib import Path
 from shutil import rmtree
 
 from .source.ephemeris import Ephemeris
 from shutil import rmtree
 
 from .source.ephemeris import Ephemeris
+from .source.holidays import Holidays
 from .source.meteofrance import MeteoFrance
 from .learn.learning import Learning
 from .learn.preprocessing import Preprocessing
 from .source.meteofrance import MeteoFrance
 from .learn.learning import Learning
 from .learn.preprocessing import Preprocessing
@@ -66,6 +67,17 @@ class Engine:
             for date in dated_features:
                 self._X.setdefault(date,{}).update(dated_features[date])
 
             for date in dated_features:
                 self._X.setdefault(date,{}).update(dated_features[date])
 
+        if self._config['FEATURES'].getboolean('holidays'):
+            holidays = Holidays(config_file =
+                                eval(self._config['FEATURE_CONFIG']['holidays']))
+
+            holidays.start = self._start
+            holidays.end = self._end
+
+            dated_features = holidays.dated_features
+            for date in dated_features:
+                self._X.setdefault(date,{}).update(dated_features[date])
+
 
     def add_target(self):
         self._target = Target(config_file = eval(self._config['TARGET']['config']),
 
     def add_target(self):
         self._target = Target(config_file = eval(self._config['TARGET']['config']),