Scikit中的分类编码器学习预处理

时间:2019-09-29 12:12:33

标签: python scikit-learn

我正试图在sklearn中导入分类编码器

from sklearn.preprocessing import CategoricalEncoder

但是我得到了错误

ImportError: cannot import name 'CategoricalEncoder' from 'sklearn.preprocessing' (D:\ProgramData\Miniconda3\lib\site-packages\sklearn\preprocessing\__init__.py)

我有sklearn的0.21.3版本。

我在线查看文档,似乎CategoricalEncoder的版本为0.20.dev0(https://15359-843222-gh.circle-artifacts.com/0/home/ubuntu/scikit-learn/doc/_build/html/stable/modules/generated/sklearn.preprocessing.CategoricalEncoder.html)。 但是在0.21.3(https://scikit-learn.org/stable/modules/classes.html#module-sklearn.preprocessing)中不存在

CategoricalEncoder发生了什么? 有没有办法我仍然可以使用它?就像我可以导入sklearn的2个版本并将其从0.20.dev0版本中拉出一样

1 个答案:

答案 0 :(得分:1)

CategoricalEncoder仅在开发版本0.20.dev0中可用。使用已安装的OneHotEncoderOrdinalEncoder。(请参见#10521