1

I‘m using scaler = preprocessing.StandardScaler().fit(X) to pre-process my feature values.

However, when it is run, there's an error saying:

AttributeError: 'module' object has no attribute 'StandardScaler'

I can successfully import preprocessing from sklearn and use its 'scale' method:
X_scaled = preprocessing.scale(X).

But StandardScaler just doesn't work. Could anybody help? Thanks

4

1 回答 1

5

使用的是什么版本sklearn?版本StandardScaler中引入。以前的版本中没有 StadardScaler 。您可能需要升级您的安装。sklearn0.13

要检查版本尝试

python -c "import sklearn; print(sklearn.__version__)"
于 2013-11-12T09:15:58.390 回答