X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/predictops.git/blobdiff_plain/964c1b87a6996c828c150a2b06a827350a4c2b10..a2faba3f0797b7be72d0c8fa9cb9db67456136d6:/predictops/learn/learning.py?ds=sidebyside diff --git a/predictops/learn/learning.py b/predictops/learn/learning.py index 4164500..9a5860a 100644 --- a/predictops/learn/learning.py +++ b/predictops/learn/learning.py @@ -15,8 +15,6 @@ class Learning: df = X df['cible'] = y - print(df.head()) - train_val_set, test_set = train_test_split(df, test_size = 0.2, random_state = 42) train_set, val_set = train_test_split(train_val_set, test_size = 0.2, random_state = 42) @@ -30,12 +28,13 @@ class Learning: if self._config['MODEL']['method'] == 'xgboost': - xgb_reg = xgboost.XGBRegressor(learning_rate = 0.01, - max_depth = 10, - random_state=42, - n_estimators = 173, - n_jobs=-1, - objective = 'count:poisson') + + xgb_reg = xgboost.XGBRegressor(learning_rate = self._config['HYPERPARAMETERS'].getfloat('learning_rate'), + max_depth = self._config['HYPERPARAMETERS'].getint('max_depth'), + random_state = self._config['HYPERPARAMETERS'].getint('random_state'), + n_estimators = self._config['HYPERPARAMETERS'].getint('n_estimators'), + n_jobs = self._config['HYPERPARAMETERS'].getint('n_jobs'), + objective = 'count:poisson') xgb_reg.fit(X_train, y_train, eval_set=[(X_val, y_val)],