Skip to content

Chapter02/car.py returns bad input shape #1

@mikayla-grace

Description

@mikayla-grace

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 ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions