I want to tune my RF model using Optuna. The dataset is imbalanced. So, I used class_weight parameter to solve this. This is my RF Model code:
model = RandomForestClassifier(
n_estimators = trial.suggest_int("clw_n_estimators", 10, 200),
max_depth = trial.suggest_int("clw_max_depth", 1, 5),
n_jobs = 4,
class_weight = {0:1,1:trial.suggest_float('clw_class_weight', 1,1.95)},
random_state = 2022,
)
When I run the Optuna, it gave me the "returned nan" message like in this picture below:
study = optuna.create_study(
direction="maximize",)
study.optimize(objective, n_trials=5)
Are there any of you that ever met this problem too and knew how to solve this?