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)
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)],