Python 随机林微调卡在运行中

Python 随机林微调卡在运行中,python,random-forest,Python,Random Forest,通过对AUC分数进行交叉验证,微调随机森林算法的超参数。上面的代码被卡在我的jupyter笔记本中。知道为什么吗?您是否尝试传递verbose=3以增加输出的详细程度?这应该告诉您代码是否仍在运行(如果您看到一些输出)或者有什么问题。只需尝试传递verbose=3,它仍然无法加载,没有输出。 rf_classifier = RandomForestClassifier(class_weight = "balanced",

通过对AUC分数进行交叉验证,微调随机森林算法的超参数。上面的代码被卡在我的jupyter笔记本中。知道为什么吗?

您是否尝试传递
verbose=3
以增加输出的详细程度?这应该告诉您代码是否仍在运行(如果您看到一些输出)或者有什么问题。只需尝试传递verbose=3,它仍然无法加载,没有输出。
rf_classifier = RandomForestClassifier(class_weight = "balanced",
                                       random_state=7)
param_grid = {'n_estimators': [50, 75, 100, 125, 150, 175],
              'min_samples_split':[2,4,6,8,10],
              'min_samples_leaf': [1, 2, 3, 4],
              'max_depth': [5, 10, 15, 20, 25]}

grid_obj = GridSearchCV(rf_classifier,
                        iid=True,
                        return_train_score=True,
                        param_grid=param_grid,
                        scoring='roc_auc',
                        cv=10)

grid_fit = grid_obj.fit(X_train, y_train)
rf_opt = grid_fit.best_estimator_

print('='*20)
print("best params: " + str(grid_obj.best_estimator_))
print("best params: " + str(grid_obj.best_params_))
print('best score:', grid_obj.best_score_)
print('='*20)