I keep having an error running this part of my code:
scores = cross_val_score(XGB_Clf, X_resampled, y_resampled, cv=kf)
The error is :
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)
I know there are lots of answers to this question, and that I need to use ravel()
, but using it does not change anything!
Also, the array "y" I'm passing to the function is not a column-vector ...
See:
y_resampled
Out[82]: array([0, 0, 0, ..., 1, 1, 1], dtype=int64)
When I run
y_resampled.ravel()
I get
Out[81]: array([0, 0, 0, ..., 1, 1, 1], dtype=int64)
which is exactly the same as my initial variable...
Also, when I run y_resampled.values.ravel()
I get an error telling me that this is well a numpy array...
Traceback (most recent call last):
File "<ipython-input-80-9d28d21eeab5>", line 1, in <module>
y_resampled.values.ravel()
AttributeError: 'numpy.ndarray' object has no attribute 'values'
Does any one of you have a solution to this?
Thanks a lot!