Python sklearn 0.22中的sklearn.feature_extraction.FeatureHasher
我刚刚更新到sklearn 0.22。我的代码以前在以前的版本中工作,但现在它给出了一个错误:Python sklearn 0.22中的sklearn.feature_extraction.FeatureHasher,python,hash,scikit-learn,feature-extraction,Python,Hash,Scikit Learn,Feature Extraction,我刚刚更新到sklearn 0.22。我的代码以前在以前的版本中工作,但现在它给出了一个错误: from sklearn.feature_extraction import FeatureHasher a = FeatureHasher(n_features = 5, input_type = 'string') 现在它给出了这个错误: Traceback (most recent call last): File "", line 1, in hasher_partner = Featur
from sklearn.feature_extraction import FeatureHasher
a = FeatureHasher(n_features = 5, input_type = 'string')
现在它给出了这个错误:
Traceback (most recent call last):
File "", line 1, in hasher_partner = FeatureHasher()
File "C:\Users\77797\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\feature_extraction\hashing.py", line 89, in init
File "C:\Users\77797\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\feature_extraction\hashing.py", line 100, in _validate_params
NameError: name 'numbers' is not defined
有什么解决办法吗?
谢谢 您使用的软件包不是
scikit learn
0.22。在回溯中,导入的模块是hashing.py
,并在0.22中重命名为\u hashing.py
你能确保你有好版本的scikit学习
import-sklearn;sklearn.\uuuu版本\uuuu
。如果您的版本为0.22,请尝试使用conda重新安装软件包:conda install scikit learn--force reinstall
numbers
是标准的库软件包。尝试在python中导入数字repl@abhilb谢谢奇怪的是,当我使用sklearn
时,我不需要导入它!