[scikit-learn] help

Alexandra Metallinou Log alexandra.log at sintef.no
Fri Jun 15 03:51:59 EDT 2018


Thank you, this worked. The error message was: undefined keyword: 'score-func'


I also changed the line of code from


scores = cross_validation.cross_val_score(model, X, Y, cv = 10, score_func = metrics.mean_squared_error)


to


scores = cross_validation.cross_val_score(model, X, Y, cv = 10, scores = 'mean_squared_error')


the code runs with this (I recieve negative outputs though, so I took the abolute value of these afterwards). However the following deprecation warning is displayed:


C:\Python27\lib\site-packages\sklearn\cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
C:\Python27\lib\site-packages\sklearn\grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
  DeprecationWarning)


When I changed the code to:


model_evaluation.cross_val_score(model, X, y, scoring='neg_mean_squared_error'),


the code runs fine ('neg_mse' was not an acceptable keyword). I still get the same deprecation warning, though I don't understand why as I am using model_evaluation now. Regardless, I think the problem is fixed.


Once again, thank you for your help!


Kind regards,


Alexandra

________________________________
Fra: scikit-learn <scikit-learn-bounces+alexandra.log=sintef.no at python.org> på vegne av Joel Nothman <joel.nothman at gmail.com>
Sendt: fredag 15. juni 2018 01.57.31
Til: Scikit-learn user and developer mailing list
Emne: Re: [scikit-learn] help

model_evaluation.cross_val_score(model, X, y, scoring='neg_mse') will produce the same, but negated so that greater is better.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20180615/65f16927/attachment.html>


More information about the scikit-learn mailing list