scikit-learn 中的哪些估计器不支持稀疏矩阵? [英] Which estimators in scikit-learn don't support sparse matrices?

查看:41
本文介绍了scikit-learn 中的哪些估计器不支持稀疏矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想训练一个有很多名义属性的数据集.我从一些帖子中注意到,要转换名义属性必须将它们转换为重复的二进制特征.此外,据我所知,这样做会在概念上使数据集变得稀疏.我也知道 scikit-learn 使用带有一些估计器的稀疏矩阵,因为它更快.但我也发现一些估计器仍然不接受稀疏矩阵.我的问题是:到目前为止,哪些不接受稀疏矩阵?

I want to train a dataset that has a lot of nominal attributes. I noticed from some posts that to convert nominal attributes on has to transform them into repetitive binary features. Also as I understood that doing so will conceptually make the dataset sparse. Also I know that scikit-learn uses sparse matrices with some estimators because it's faster or so. But also I found that some estimators don't accept sparse matrices, still. My question is: which ones don't accept sparse matrices until now?

推荐答案

您可以通过检查 docstring 来检查 scikit-learn 中的方法是否支持稀疏矩阵.如果它说

You can check whether a method in scikit-learn supports sparse matrices by checking the docstring. If it says

X : {array-like, sparse matrix}

然后支持稀疏矩阵输入.当它说只是类似数组"时,它们不受支持.

then sparse matrix inputs are supported. When it says just "array-like", they're not supported.

这篇关于scikit-learn 中的哪些估计器不支持稀疏矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆