Update randomized searchCV

main
Spagnolo Gasper 2022-12-24 09:16:17 +01:00
parent 338efa332b
commit 87db4a6457
1 changed files with 8 additions and 8 deletions

View File

@ -38,8 +38,6 @@ def predict():
"learning_rate": [0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5], "learning_rate": [0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5],
"max_depth": [1, 3, 4, 5, 6, 7, 8, 9, 10], "max_depth": [1, 3, 4, 5, 6, 7, 8, 9, 10],
"min_samples_split": [2, 5, 10, 15, 100], "min_samples_split": [2, 5, 10, 15, 100],
"ccp_alpha": [0.0, 0.001, 0.005, 0.01, 0.05],
"loss": ["deviance", "exponential"],
"tol": [1e-4, 1e-3, 1e-2, 1e-1, 1e-0], "tol": [1e-4, 1e-3, 1e-2, 1e-1, 1e-0],
"validation_fraction": [0.1, 0.2, 0.3, 0.4, 0.5], "validation_fraction": [0.1, 0.2, 0.3, 0.4, 0.5],
"min_samples_leaf": [1, 2, 5, 10], "min_samples_leaf": [1, 2, 5, 10],
@ -53,14 +51,16 @@ def predict():
# Model # Model
from sklearn.ensemble import GradientBoostingClassifier from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import GridSearchCV from sklearn.model_selection import RandomizedSearchCV
model = GridSearchCV( model = RandomizedSearchCV(
estimator=GradientBoostingClassifier(), GradientBoostingClassifier(),
param_grid=hyper_params, hyper_params,
cv=5, n_iter=100000,
scoring="roc_auc",
n_jobs=-1, n_jobs=-1,
verbose=1 cv=5,
verbose=1,
) )
model.fit(X_train, y_train) model.fit(X_train, y_train)