So in attempt to get multiple score metrics from the cross_val_score(), I
made a scorer from metrics.precision_recall_
fscore_support(), and when using it, it throws an error:
File
"/usr/local/lib64/python2.7/site-packages/sklearn/cross_validation.py",
line 1174, in cross_val_score
for train, test in cv)
File
"/usr/local/lib64/python2.7/site-packages/sklearn/externals/joblib/parallel.py",
line 514, in __call__
self.dispatch(function, args, kwargs)
File
"/usr/local/lib64/python2.7/site-packages/sklearn/externals/joblib/parallel.py",
line 311, in dispatch
job = ImmediateApply(func, args, kwargs)
File
"/usr/local/lib64/python2.7/site-packages/sklearn/externals/joblib/parallel.py",
line 135, in __init__
self.results = func(*args, **kwargs)
File
"/usr/local/lib64/python2.7/site-packages/sklearn/cross_validation.py",
line 1084, in _cross_val_score
" instead." % (str(score), type(score)))
ValueError: scoring must return a number, got (array([ 0.96153846,
0.94318182]), array([ 0.83333333, 0.98809524]), array([ 0.89285714,
0.96511628]), array([30, 84])) (<type 'tuple'>) instead.
I realize this is something in the code that I can't modify in my script,
but I was wondering if there's a specific reason why the scoring must
return only one number? From the array in the error message, it doesn't
seem to have any problem calculating multiple metrics for a
cross-validation fold, just storing them.If the return function was just
tweaked to accept multiple values, that would give the scoring function a
lot more functionality.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general