Skip to content

Commit 09d06df

Browse files
committed
fix: add missing hyperparameters min_samples_leaf and max_features to RandomForestRegressor
1 parent 317cd55 commit 09d06df

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/forecasting/rapids_gpu_forecasting.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def _get_default_config(self) -> Dict:
117117
"n_estimators": 100,
118118
"max_depth": 10,
119119
"min_samples_split": 5,
120-
"min_samples_leaf": 2
120+
"min_samples_leaf": 2,
121+
"max_features": "sqrt" # sqrt(n_features) for RandomForest
121122
}
122123

123124
async def initialize_connection(self):
@@ -366,12 +367,16 @@ async def train_models(self, X, y):
366367
rf_model = cuRandomForestRegressor(
367368
n_estimators=self.config['n_estimators'],
368369
max_depth=self.config['max_depth'],
370+
min_samples_leaf=self.config.get('min_samples_leaf', 2),
371+
max_features=self.config.get('max_features', 'sqrt'),
369372
random_state=self.config['random_state']
370373
)
371374
else:
372375
rf_model = RandomForestRegressor(
373376
n_estimators=self.config['n_estimators'],
374377
max_depth=self.config['max_depth'],
378+
min_samples_leaf=self.config.get('min_samples_leaf', 2),
379+
max_features=self.config.get('max_features', 'sqrt'),
375380
random_state=self.config['random_state']
376381
)
377382

0 commit comments

Comments
 (0)