You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chapter02/car.py returns bad input shape with scikit-learn 0.18-2. How to fix?
-> python car.py
/usr/lib64/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Accuracy of the classifier: 78.19%
Traceback (most recent call last):
File "car.py", line 45, in <module>
input_data_encoded[i] = int(label_encoder[i].transform(input_data[i]))
File "/usr/lib64/python2.7/site-packages/sklearn/preprocessing/label.py", line 143, in transform
y = column_or_1d(y, warn=True)
File "/usr/lib64/python2.7/site-packages/sklearn/utils/validation.py", line 562, in column_or_1d
raise ValueError("bad input shape {0}".format(shape))
ValueError: bad input shape ()
The text was updated successfully, but these errors were encountered:
The function transform() takes parameter as a list of values. Even you have a single value, you still have to convert into a list of a single value, i.e., [input_data[i]].
Chapter02/car.py returns bad input shape with scikit-learn 0.18-2. How to fix?
The text was updated successfully, but these errors were encountered: