From bfc202118fe3cd833550a504cb06e3e48fbcea7a Mon Sep 17 00:00:00 2001 From: Tuan Pham Date: Mon, 1 May 2023 23:13:34 +0700 Subject: [PATCH 1/2] feat: add function to get build param from XGB --- h1st/model/ml/xgboost/regression.py | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/h1st/model/ml/xgboost/regression.py b/h1st/model/ml/xgboost/regression.py index 92695e3d..752e14b8 100644 --- a/h1st/model/ml/xgboost/regression.py +++ b/h1st/model/ml/xgboost/regression.py @@ -224,6 +224,47 @@ def __init__( 'debug': debug, } + def __get_model_build_params(self, model: XGBRegressionModel) -> dict: + return { + 'max_depth': model.max_depth, + 'max_leaves': model.max_leaves, + 'max_bin': model.max_bin, + 'grow_policy': model.grow_policy, + 'learning_rate': model.learning_rate, + 'n_estimators': model.n_estimators, + 'verbosity': model.verbosity, + 'booster': model.booster, + 'tree_method': model.tree_method, + 'n_jobs': model.n_jobs, + 'gamma': model.gamma, + 'min_child_weight': model.min_child_weight, + 'max_delta_step': model.max_delta_step, + 'subsample': model.subsample, + 'sampling_method': model.sampling_method, + 'colsample_bytree': model.colsample_bytree, + 'colsample_bylevel': model.colsample_bylevel, + 'colsample_bynode': model.colsample_bynode, + 'reg_alpha': model.reg_alpha, + 'reg_lambda': model.reg_lambda, + 'scale_pos_weight': model.scale_pos_weight, + 'base_score': model.base_score, + 'random_state': model.random_state, + 'missing': model.missing, + 'num_parallel_tree': model.num_parallel_tree, + 'monotone_constraints': model.monotone_constraints, + 'interaction_constraints': model.interaction_constraints, + 'importance_type': model.importance_type, + 'gpu_id': model.gpu_id, + 'validate_parameters': model.validate_parameters, + 'predictor': model.predictor, + 'enable_categorical': model.enable_categorical, + 'feature_types': model.feature_types, + 'max_cat_to_onehot': model.max_cat_to_onehot, + 'max_cat_threshold': model.max_cat_threshold, + 'eval_metric': model.eval_metric, + 'early_stopping_rounds': model.early_stopping_rounds + } + def train_base_model(self, input_data: dict) -> XGBRegressor: """ This function can be used to build and train XGBRegression model. @@ -329,6 +370,7 @@ def train_base_model(self, input_data: dict) -> XGBRegressor: } ) self.stats['input_features'] = features + self.stats['build_params'] = self.__get_model_build_params(model) return model def prepare_data(self, prepared_data: dict): From d0fd514c8a3decc771b62d83ab4982d5d612d92a Mon Sep 17 00:00:00 2001 From: Tuan Pham Date: Tue, 2 May 2023 00:15:08 +0700 Subject: [PATCH 2/2] build: update version to 2.1.0 --- pyproject.toml | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9fc952f8..5f6fb932 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "h1st" -version = "0.1.13" +version = "2.1.0" description = "Human-First AI (H1st)" authors = ["Aitomatic, Inc. "] license = "Apache-2.0" diff --git a/setup.cfg b/setup.cfg index a142bf1b..889c765a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,4 +4,4 @@ [metadata] name = h1st -version = 0.1.12 +version = 2.1.0