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

前端 未结 2 481
遥遥无期
遥遥无期 2020-11-29 22:07

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 return

2条回答
  •  佛祖请我去吃肉
    2020-11-29 22:48

    You can fix it by changing scoring method to "neg_mean_squared_error" as you can see below:

    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='neg_mean_squared_error')
    

提交回复
热议问题