-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
"scoring must return a number" error with custom scorer #6783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure what's going on here. But I thought I'd point out that calling |
@jnothman: Thanks! That was next on my list to understand! |
So I think we don't have enough information to tackle this issue. What is the dtype of |
I've updated the example to include dummy data that trigger the bug on my machine. X=X_train is originally an ndarray of float64's. When we call _fit_and_score() in cross_validation.py, X is now a memmap of float64's. |
Description
I'm encountering the same error (
ValueError: scoring must return a number, got [...] (<class 'numpy.core.memmap.memmap'>) instead.
) as #6147, despite running v0.17.1. This is because I'm creating my own scorer, following the example in this article.Steps/Code to Reproduce
Expected Results
No error.
Actual Results
Same error as in #6147 :
Workaround
Updated
perc_diff_score()
as follows to add cast tofloat
.:Versions
Darwin-15.4.0-x86_64-i386-64bit
Python 3.5.1 |Anaconda 4.0.0 (x86_64)| (default, Dec 7 2015, 11:24:55)
[GCC 4.2.1 (Apple Inc. build 5577)]import numpy; print("NumPy", numpy.version)
NumPy 1.11.0
SciPy 0.17.0
Scikit-Learn 0.17.1
The text was updated successfully, but these errors were encountered: