分析 TPOT 的穩定性
你現在將透過以不同的 random state 建立分類器,觀察 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))