1
$\begingroup$

I have 102 observations. I made standard scale for dataset. I have found the accuracy training and accuracy testing values, but training score is 1.00 and testing score is -217.541. I have run with MLPRegressor score. What does negative accuracy testing score mean?

FileX_train, FileX_test,FileY_train,FileY_test = train_test_split(FileX,FileY,test_size=0.33, random_state=0)

sc = StandardScaler()
X_train = sc.fit_transform(FileX_train)
X_test = sc.transform(FileX_test)

sc = StandardScaler()
Y_train = sc.fit_transform(FileY_train)
Y_test = sc.transform(FileY_test)

from sklearn.neural_network import MLPRegressor
from sklearn.metrics import accuracy_score
mlp = MLPRegressor(solver='lbfgs',activation='tanh', hidden_layer_sizes=(100,), max_iter=1000000000, learning_rate='constant')
mlp.fit(X_train, Y_train.ravel())
print('Accuracy training : {:.3f}'.format(mlp.score(X_train, Y_train)))
print('Accuracy testing : {:.3f}'.format(mlp.score(X_test, Y_test)))

Results:

Accuracy training : 1.000 Accuracy testing : -217.541

$\endgroup$

1 Answer 1

2
$\begingroup$

You haven't actually used accuracy_score, and the default scorer for sklearn regressors is R^2:
https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPRegressor.html#sklearn.neural_network.MLPRegressor.score

A negative value for R^2 generally means a very bad fit:
https://stats.stackexchange.com/q/12900/232706

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.