Dear Sir/Madam, I have stumbled upon a problem while trying to run some old code using skcikit-learn: scores = cross_validation.cross_val_score(model, X, Y, cv = 10, score_func = metrics.mean_squared_error) This line will not run in a program I downloaded, and as I am not yet very familliar with scikit-learn I do not know how I should replace "score_func = metrics.mean_squared_error" to produce the same result as intended by the ones who made the program. Any help is greatly appreciated. Best regards, Alexandra Log
Hey Alexandra, Can you maybe share the error output? gr, Prokopis On Thu, Jun 14, 2018 at 5:20 PM Alexandra Metallinou Log < alexandra.log@sintef.no> wrote:
Dear Sir/Madam,
I have stumbled upon a problem while trying to run some old code using skcikit-learn:
scores = cross_validation.cross_val_score(model, X, Y, cv = 10, score_func = metrics.mean_squared_error)
This line will not run in a program I downloaded, and as I am not yet very familliar with scikit-learn I do not know how I should replace "score_func = metrics.mean_squared_error" to produce the same result as intended by the ones who made the program. Any help is greatly appreciated.
Best regards,
Alexandra Log
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Hey Alexandra . Could you please post a minimal, complete, and verifiable example? Apart from this could you post the exact error message? Best, Chris On Thu, Jun 14, 2018 at 1:44 PM, Alexandra Metallinou Log < alexandra.log@sintef.no> wrote:
Dear Sir/Madam,
I have stumbled upon a problem while trying to run some old code using skcikit-learn:
scores = cross_validation.cross_val_score(model, X, Y, cv = 10, score_func = metrics.mean_squared_error)
This line will not run in a program I downloaded, and as I am not yet very familliar with scikit-learn I do not know how I should replace "score_func = metrics.mean_squared_error" to produce the same result as intended by the ones who made the program. Any help is greatly appreciated.
Best regards,
Alexandra Log
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
model_evaluation.cross_val_score(model, X, y, scoring='neg_mse') will produce the same, but negated so that greater is better.
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@python.org> på vegne av Joel Nothman <joel.nothman@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.
Sorry, should have been model_selection, not model_evaluation. cross_validation is now deprecated. On Sat, 16 Jun 2018 at 18:28, Alexandra Metallinou Log < alexandra.log@sintef.no> wrote:
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@python.org> på vegne av Joel Nothman <joel.nothman@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. _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
participants (4)
-
Alexandra Metallinou Log -
Christos Aridas -
Joel Nothman -
Prokopis Gryllos