开始使用免费开始使用

复用模型参数

在模型验证中,复现实验结果至关重要。与同事共享模型、在新数据上复用模型,或在像 Stack Overflow 这样的网站上提问时,复现同样很重要。您可能会就模型报错、输出或性能向其他开发者请教。最佳做法是通过复用模型参数来复现您的工作。

在本练习中,您将使用多种方法回顾模型中使用了哪些参数。

本练习是课程的一部分

Python 中的模型验证

查看课程

练习说明

  • 直接打印模型,输出模型 rfc 的各项特征。
  • 仅打印模型的随机状态(random state)。
  • 打印模型参数的字典。

交互式实操练习

通过完成这段示例代码来试试这个练习。

rfc = RandomForestClassifier(n_estimators=50, max_depth=6, random_state=1111)

# Print the classification model
____(____)

# Print the classification model's random state parameter
print('The random state is: {}'.format(rfc.____))

# Print all parameters
print('Printing the parameters dictionary: {}'.format(rfc.____()))
编辑并运行代码