Reputation: 41
I have been stuck with this error for quite a while. Whenever I run this code, I get the following error:
raise ValueError("Found input variables with inconsistent numbers of "ValueError: Found input variables with inconsistent numbers of samples: [10725, 3575]
Here's my code snippet:
n_classes = len(classes)
X_train, X_test, y_train, y_test = train_test_split(X, Y, random_state=0, test_size = 0.75)
X_train_scale = X_train/255.0
X_test_scale = X_test/255.0
Upvotes: 1
Views: 880
Reputation: 359
You got this error because train_test_split requires that X and Y must have the same length while it's not the case here. In fact :
X.shape[0] == 10725
while Y.shape[0] == 3575
To solve this you have to reshape your X. Here is my suggestion:
X.reshape(Y.shape[0], -1)
Upvotes: 0