Plot Learning Curve of CatBoostClassifier with Yellowbrick

不羁的心 提交于 2020-12-15 06:50:54

问题


I'm trying to plot a learning curve for the CatBoostClassifier. The error occurs when I fit the CatBoostClassifier into LearningCurve from yellowbrick. I think this should work since CatBoost is sklearn compatible and yellow brick is a sklearn extension.

Code snippet:

kf = RepeatedStratifiedKFold(n_splits=10, n_repeats=3, random_state=0)
sizes = np.linspace(0.2, 1.0, 10)
estimator = CatBoostClassifier(
    iterations=42, learning_rate=0.3, max_depth=10)

visualizer = LearningCurve(
    estimator, cv=kf, scoring='accuracy', train_sizes=sizes, n_jobs=-1
)

visualizer.fit(X, y)
visualizer.show()

Error:

... yellowbrick.exceptions.YellowbrickTypeError: Cannot detect the model name for non estimator: ''

Any suggestions?


回答1:


I could plot a learning curve for XGBClassifier, I think it should also work for CatBoostClassifier. visualizer.show() won't work though. Use visualizer.poof() to render the plot.



来源:https://stackoverflow.com/questions/61966426/plot-learning-curve-of-catboostclassifier-with-yellowbrick

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!