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
Chapter 9 error in Sklearn "DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True)"
#33
Open
richlysakowski opened this issue
Jul 5, 2022
· 1 comment
throws a warning, and then a fatal error. I don't know how to fix this yet. Instructions are vague unclear.
C:\Programdata\Anaconda3\envs\tensorflow\lib\site-packages\sklearn\preprocessing_label.py:154: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
y = column_or_1d(y, warn=True)
ValueError Traceback (most recent call last)
Input In [40], in <cell line: 1>()
----> 1 wtp_dnn_predictions = le.inverse_transform(wtp_dnn_ypred)
The code in Chapter 9 example on "Analyzing Wine Types"
wtp_dnn_predictions = le.inverse_transform(wtp_dnn_ypred)
throws a warning, and then a fatal error. I don't know how to fix this yet. Instructions are vague unclear.
C:\Programdata\Anaconda3\envs\tensorflow\lib\site-packages\sklearn\preprocessing_label.py:154: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
y = column_or_1d(y, warn=True)
ValueError Traceback (most recent call last)
Input In [40], in <cell line: 1>()
----> 1 wtp_dnn_predictions = le.inverse_transform(wtp_dnn_ypred)
File C:\Programdata\Anaconda3\envs\tensorflow\lib\site-packages\sklearn\preprocessing_label.py:161, in LabelEncoder.inverse_transform(self, y)
159 diff = np.setdiff1d(y, np.arange(len(self.classes_)))
160 if len(diff):
--> 161 raise ValueError("y contains previously unseen labels: %s" % str(diff))
162 y = np.asarray(y)
163 return self.classes_[y]
ValueError: y contains previously unseen labels: [0.12855081 0.12855084 0.1564262 ... 0.56348777 0.5781211 0.60708743]
The text was updated successfully, but these errors were encountered: