Value error: Input arrays should have the same number of samples as target arrays. Found 1600 input samples and 6400 target samples
Looks like you have 1600 examples for training. And your 8 classes are not separated in samples, so you have an array with 8 x 1600 = 6400 values.
That array must be something such as (1600,8). That is: 1600 samples with 8 possible classes.
Now you need to know how your train_labels
array is organized. Maybe a simple reshape((1600,8))
is enough, if the array is properly ordered.
If not, you have to organize it yourself in 1600 samples of eight labels.
It is not about len(X_train) != len(y_train).
Split the data into equal size for training and testing(validation). Make sure that the input data size is even. If not try to trim the data by omitting the last observation in the input data.
train_test_split(X,y, test_size = 0.5, random_state=42)
This is working for me.