From: Christophe Guyeux Date: Tue, 18 Feb 2020 16:05:04 +0000 (+0100) Subject: XGBoost integrated X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/predictops.git/commitdiff_plain/661ece8c54b20d4c559e5f73616cc213f8c4f6b7?ds=inline;hp=288baa6ff06c1b815ec24d164770acc93ac80499 XGBoost integrated --- diff --git a/config/learn.cfg b/config/learn.cfg index 53c62de..29bd628 100644 --- a/config/learn.cfg +++ b/config/learn.cfg @@ -1,7 +1,7 @@ [DATETIME] -start = 01/01/2006 00:00:00 +start = 01/01/2010 01:00:00 end = 12/31/2017 23:00:00 -hourStep = 1 +hourStep = 5 [FEATURES] diff --git a/config/learners/xgboost.cfg b/config/learners/xgboost.cfg index 61975c2..0dd78d0 100644 --- a/config/learners/xgboost.cfg +++ b/config/learners/xgboost.cfg @@ -1,2 +1,10 @@ [MODEL] -method = xgboost \ No newline at end of file +method = xgboost + +[HYPERPARAMETERS] +learning_rate = 0.01, +max_depth = 10, +random_state=42, +n_estimators = 173, +n_jobs=-1, +objective = 'count:poisson' \ No newline at end of file diff --git a/predictops/learn/preprocessing.py b/predictops/learn/preprocessing.py index 51ecb4e..106a626 100644 --- a/predictops/learn/preprocessing.py +++ b/predictops/learn/preprocessing.py @@ -171,9 +171,14 @@ class Preprocessing: # Dropping rows that are not related to our datetime window (start/ # step / end) - self._dataframe = self._dataframe.drop([k.to_pydatetime() - for k in self._dataframe.T - if k not in self._datetimes]) + logger.info("Dropping rows that are not related to our datetime window") + self._dataframe['datetime'] =\ + self._dataframe.apply(lambda x: datetime(int(x.year), int(x.month), int(x.dayInMonth), int(x.hour)), axis=1) + self._dataframe['row_ok'] =\ + self._dataframe.apply(lambda x:x.datetime in self._datetimes, axis=1) + self._dataframe = self._dataframe[self._dataframe['row_ok']] + self._dataframe = self._dataframe.drop(['datetime', 'row_ok'], axis=1) + logger.info("Rows dropped") def _add_history(self):