[英]I am implementing machine learning linear regression algorithim i got name error(NameError: name 'names' is not defined)
[英]In machine learning(Linear Regression), in the training/test process I got this Type Error. Can someone help me with that?
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder = LabelEncoder()
X[:, 3] = labelencoder.fit_transform(X[:, 3])
onehotencoder = OneHotEncoder(categorical_features = [3])
X = onehotencoder.fit_transform(X).toarray()
print(X)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-33-723c0ae23eaf> in <module>
3 X[:, 3] = labelencoder.fit_transform(X[:, 3])
4
----> 5 onehotencoder = OneHotEncoder(categorical_features = [3])
6 X = onehotencoder.fit_transform(X).toarray()
7 print(X)
~\anaconda3\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
70 FutureWarning)
71 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 72 return f(**kwargs)
73 return inner_f
74
TypeError: __init__() got an unexpected keyword argument 'categorical_features'
参数应该是根据sklearn docs的categories
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.