]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
feat: add n_estimators to HPO
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 25 Jan 2025 22:52:40 +0000 (23:52 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 25 Jan 2025 22:52:40 +0000 (23:52 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/LightGBMRegressorQuickAdapterV35.py
quickadapter/user_data/freqaimodels/XGBoostRegressorQuickAdapterV35.py

index ecd61afefe48af0960cb76c0c01f0a31abcfc90c..0a4a8fdf2b28e3ed18f7ee8713b4e3cd009dd2c4 100644 (file)
@@ -98,6 +98,7 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel):
             params = {
                 **self.model_training_parameters,
                 **{
+                    "n_estimators": hp.get("n_estimators"),
                     "learning_rate": hp.get("learning_rate"),
                     "reg_alpha": hp.get("reg_alpha"),
                     "reg_lambda": hp.get("reg_lambda"),
@@ -214,6 +215,7 @@ class LightGBMRegressorQuickAdapterV35(BaseRegressionModel):
 def objective(trial, X, y, weights, X_test, y_test, params):
     study_params = {
         "objective": "rmse",
+        "n_estimators": trial.suggest_int("n_estimators", 100, 1000),
         "learning_rate": trial.suggest_loguniform("learning_rate", 1e-8, 1.0),
         "reg_alpha": trial.suggest_loguniform("reg_alpha", 1e-8, 10.0),
         "reg_lambda": trial.suggest_loguniform("reg_lambda", 1e-8, 10.0),
index 2c34f432adcdd06c893389cd4c4bc85ad8ea661b..55a1e662d976dd0842495682d9b041fa28be640e 100644 (file)
@@ -98,6 +98,7 @@ class XGBoostRegressorQuickAdapterV35(BaseRegressionModel):
             params = {
                 **self.model_training_parameters,
                 **{
+                    "n_estimators": hp.get("n_estimators"),
                     "learning_rate": hp.get("learning_rate"),
                     "gamma": hp.get("gamma"),
                     "reg_alpha": hp.get("reg_alpha"),
@@ -216,6 +217,7 @@ def objective(trial, X, y, weights, X_test, y_test, params):
     study_params = {
         "objective": "reg:squarederror",
         "eval_metric": "rmse",
+        "n_estimators": trial.suggest_int("n_estimators", 100, 1000),
         "learning_rate": trial.suggest_loguniform("learning_rate", 1e-8, 1.0),
         "gamma": trial.suggest_loguniform("gamma", 1e-8, 1.0),
         "reg_alpha": trial.suggest_loguniform("reg_alpha", 1e-8, 10.0),