开始使用免费开始使用

分析 TPOT 的稳定性

现在,您将通过使用不同的随机种子来构建分类器,并观察算法认定的最佳模型,从而体会 TPOT 的随机性。这有助于说明:若运行时间不够长,TPOT 的结果可能相当不稳定。

本练习是课程的一部分

Python 中的超参数调优

查看课程

交互式实操练习

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

# Create the tpot classifier 
tpot_clf = TPOTClassifier(generations=2, population_size=4, offspring_size=3, scoring='accuracy', cv=2,
                          verbosity=2, random_state=____)

# Fit the classifier to the training data
tpot_clf.fit(X_train, y_train)

# Score on the test set
print(tpot_clf.score(X_test, y_test))
编辑并运行代码