pypiregression95% confidence\u2191 72

scikit-learn cross validation, negative values with mean squared error

Full error message
When I use the following code with Data matrix X of size (952,144) and output vector y of size (952), mean_squared_error metric returns negative values, which is unexpected. Do you have any idea?

from sklearn.svm import SVR
from sklearn import cross_validation as CV

reg = SVR(C=1., epsilon=0.1, kernel='rbf')
scores = CV.cross_val_score(reg, X, y, cv=10, scoring='mean_squared_error')

all values in scores are then negative.

Trying to close this out, so am providing the answer that David and larsmans have eloquently described in the comments section: Yes, this is supposed to happen. The actual MSE is simply the positive version of the number you're getting. The unified scoring API always maximizes the score, so scores which need to be minimized are negated in order for the unified scoring API to work correctly. The score that is returned is therefore negated when it is a score that should be minimized and left positive if it is a score that should be maximized. This is also described in sklearn GridSearchCV with Pipeline.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/d3087650dd90ec507a50b1b99b09b96d3a9fbed73d1c31423960e26f61449342
hash \u00b7 d3087650dd90ec507a50b1b99b09b96d3a9fbed73d1c31423960e26f61449342
scikit-learn cross validation, negative values with mean squ… — DepScope fix | DepScope