From 3340bab4196c2737236216ad3845afa74d0b7f39 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 17 Jan 2022 08:43:04 +0100 Subject: XGBoost: add env variables for num regressors and max depth --- lib/parameters.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/parameters.py b/lib/parameters.py index 401c7c6..1239046 100644 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -936,16 +936,20 @@ class ModelAttribute: return if with_xgboost: - from xgboost import XGBRegressor + import xgboost # TODO retrieve parameters from env - xgb = XGBRegressor( - n_estimators=100, - max_depth=10, - eta=0.2, + # + # n_estimators := number of trees in forest + # max_depth := maximum tree depth + # eta <=> learning_rate + xgb = xgboost.XGBRegressor( + n_estimators=int(os.getenv("DFATOOL_XGB_N_ESTIMATORS", "100")), + max_depth=int(os.getenv("DFATOOL_XGB_MAX_DEPTH", "10")), + learning_rate=0.2, subsample=0.7, gamma=0.01, - alpha=0.0006, + reg_alpha=0.0006, ) fit_parameters, category_to_index, ignore_index = param_to_ndarray( parameters, with_nan=False, categorial_to_scalar=categorial_to_scalar -- cgit v1.2.3