简体   繁体   中英

Categorical Encoder in Scikit Learn Preprocessing

I was trying to import Categorical Encoder in sklearn

from sklearn.preprocessing import CategoricalEncoder

But I get the error

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

I have version 0.21.3 of sklearn.

I checked online to see the documentation and it seems that CategoricalEncoder was there in version 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 ) But is not there in 0.21.3 ( https://scikit-learn.org/stable/modules/classes.html#module-sklearn.preprocessing )

What happened to CategoricalEncoder? Is there a way I can still use it? Like can I import 2 versions of sklearn and pull it from the 0.20.dev0 version

CategoricalEncoder is only available in the development version 0.20.dev0. Use OneHotEncoder and OrdinalEncoder insted.(see #10521 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM