如何在Catboost分类器上适合Sklearn Pipeline具有嵌入功能

发布于 2025-02-12 17:44:26 字数 517 浏览 1 评论 0原文

我有一个catboost分类器,可以预测一些嵌入功能,而AFAIK只能通过池指定这些嵌入功能(这意味着我必须创建一个池,然后通过catboost分类器的 method将池传递。为了使模型捡起)。

这些嵌入功能由tfidfvectorizer生成,因此我想包装tfidfvectorizer和分类器作为Sklearn pipeline的一部分,以使其整理我的代码并有清晰的管道来训练/预测。

不幸的是,我无法将catboost pool传递给Sklearn Pipeline,因为当我这样做时,我会收到以下错误:

Expected 2D array, got scalar array instead:
array=<catboost.core.Pool object at 0x7f98f0256820>.

是否有任何方法可以解决此问题?

I have a Catboost Classifier that predicts on some embedding features, and AFAIK these embedding features can only be specified through Pools (meaning I have to create a pool and then pass the pool for the Catboost classifier's .fit method in order for the model to pick them up).

These embedding features are generated by a TfidfVectorizer, so I would like to wrap the TfidfVectorizer and the classifier as part of an sklearn Pipeline to tidy up my code and have a clear pipeline to train/predict.

Unfortunately, I cannot pass Catboost Pool to an sklearn Pipeline because when I do, I get the following error:

Expected 2D array, got scalar array instead:
array=<catboost.core.Pool object at 0x7f98f0256820>.

Is there any way around this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文