Sep-14-2021, 09:11 PM
Hi all,
I have this code that compiles all the way to the end. Once the function returns it goes though some accuracy calculations that are not set by me and hence I cannot really debug it. Though it might be something in my code.
result shape is
(200,)
ypred shape is
(200,)
y_train shape is
(800,)
X_train shape is
(800, 61)
WE ARE DONE
And the code throws the error as Found input variables with inconsistent numbers of samples: [1000, 200] where my result variable is of shape (200,). Though my datataframe is of size 1000x13. Any suggestions? THanks
Jenya
I have this code that compiles all the way to the end. Once the function returns it goes though some accuracy calculations that are not set by me and hence I cannot really debug it. Though it might be something in my code.
# Encoding categorical data in y
labelencoder_y = LabelEncoder()
y = labelencoder_y.fit_transform(y)
self.X_train, self.X_test, self.y_train, self.y_test = train_test_split(X, y, test_size=0.2, random_state = 40)
sc = StandardScaler()
self.X_train = sc.fit_transform(self.X_train)
self.X_test = sc.transform(self.X_test)
# Fit to the training data
self.clf.fit(self.X_train, self.y_train)
y_pred = self.clf.predict(self.X_test)
print(accuracy_score(self.y_test, y_pred))
result = np.array(y_pred, dtype=bool)
#resulti = resulti.reshape((200,1))
result
print("result")
print(result.shape)
print('ypred')
print(y_pred.shape)
print('y_train')
print(self.y_train.shape)
print('X_train')
print(self.X_train.shape)
print("WE ARE DONE") return resultresult shape is
(200,)
ypred shape is
(200,)
y_train shape is
(800,)
X_train shape is
(800, 61)
WE ARE DONE
And the code throws the error as Found input variables with inconsistent numbers of samples: [1000, 200] where my result variable is of shape (200,). Though my datataframe is of size 1000x13. Any suggestions? THanks
Jenya
