Reputation: 932
Scikit-Learn gives an error: "cannot import name 'KBinsDiscretizer'". Run on Jupyter notebook with Anaconda distribution.
Minimal working example:
from sklearn.preprocessing import KBinsDiscretizer
X = [[-2, 1, -4, -1],
[-1, 2, -3, -0.5],
[ 0, 3, -2, 0.5],
[ 1, 4, -1, 2]]
est = KBinsDiscretizer(n_bins=3, encode='ordinal', strategy='uniform').fit(X)
Xt = est.transform(X)
Xt
-All the other functions within sklearn.preprocessing have worked fine.
It was a package management issue.
Open "Anaconda prompt" as the administrator
Code:
conda env list #only base is listed
conda list -n base #scikit-learn 0.19.1
conda install --name base scikit-learn=0.20.0 #install new version
Upvotes: 4
Views: 3073
Reputation: 68
Just type in the following command in anaconda prompt
conda update scikit-learn
It should upgrade to version 0.20
Upvotes: 2