I have to classificate the svhn dataset with the Perceptron on scikit-learn libray in python, but i don't understand why the accuracy score is very low(21%);
the dataset is the svhn dataset cropped image format and i have to pass the image in grayscale
The Problem is that i have an accuracy of 21% and this is too low.
this is the code that i use:
train = sio.loadmat("train_32x32.mat")
test = sio.loadmat("test_32x32.mat")
data = train["X"]
data = np.transpose(data, [3, 0, 1, 2])
data = np.mean(data, axis=3)
X_train = np.zeros(shape=(73257, 1024))
label = train['y'].ravel()
for i in range(73257):
X_train[i] = data[i].flatten()
clf = Perceptron()
clf.fit(X_train, label)
print(clf.score(X_train, label))
predict = clf.predict(X_train)
print(accuracy_score(label, predict))