使用 GridSearchCV 的模型结果
您已经找到了模型的最佳参数:划分准则设为 'gini',基学习器(树)的数量为 30,模型的最大深度为 8,最大特征数设为 "log2"。
我们来试试这些设置,看看模型表现如何。您可以再次使用 get_model_results() 函数以节省时间。
本练习是课程的一部分
Python 中的欺诈检测
练习说明
- 在模型定义中输入最优设置。
- 拟合模型,生成预测,并使用
get_model_results()获取性能指标。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Input the optimal parameters in the model
model = RandomForestClassifier(class_weight={0:1,1:12}, ____='____',
____=____, ____='log2', min_samples_leaf=10, ____=____, n_jobs=-1, random_state=5)
# Get results from your model
get_model_results(____, ____, ____, ____, ____)