使用Yellowbrick绘制CatBoostClassifier的学习曲线

我尝试为CatBoostClassifier绘制学习曲线。当我将CatBoostClassifier拟合到Yellowbrick的LearningCurve中时出现了错误。我认为这应该可以工作,因为CatBoost与sklearn兼容,而Yellowbrick是sklearn的扩展。

代码片段:

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()

错误:

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

有什么建议吗?


回答:

您可以使用第三方估计器的包装器,更多详情。我已经尝试过了,确实有效。类似这样的代码:

from yellowbrick.classifier import ROCAUCfrom yellowbrick.contrib.wrapper import wrapcatboost_model = CatBoostClassifier()model = wrap(catboost_model)visualizer = ROCAUC(model)visualizer.fit(X_train, y_train)visualizer.score(X_test, y_test)visualizer.show()

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注