<p dir="auto">Fitting a model several times when building a validation or a learning curve can be costly while the evaluation of the scorer can be very fast.</p>
<p dir="auto">It would be interesting if it would be possible to evaluate a list of scorers given to:</p>
<p dir="auto"><code class="notranslate">sklearn.learning_curve.learning_curve</code><br>
<code class="notranslate">sklearn.learning_curve.validation_curve</code></p>
<p dir="auto">as the argument <code class="notranslate">scoring = [scorer1, scorer2, scorer3, ... ]</code></p>
<p dir="auto">As a workaround, I'm going to see if my scorer can return a float with extra info in the form of extra properties, like the extra scorers that I want to evaluate (in my particular case, I'm even going to try including confusion matrixes), although I'm quite new at Python, and I don't know if such a thing is possible/easy. Nevertheless such an approach seems unnecessarily twisted.</p>
<p dir="auto">Learning curve and validation curves are the two  functions that are relevant to me. I don't know whether there are any other methods which may be susceptible of this enhancement.</p>
<p dir="auto">Would you consider as feasible expanding scoring functionality to accept lists of scorers?</p>
<p dir="auto"><code class="notranslate">Scorer</code> objects currently provide an interface that returns a scalar score given an estimator and test data. This is necessary for <code class="notranslate">*SearchCV</code> to calculate a mean score across folds, and determine the best score among parameters.</p>
<p dir="auto">This is very hampering in terms of the diagnostic information available from a cross-fold validation or parameter exploration, which one can see by comparing to the catalogue of <code class="notranslate">metrics</code> that includes: precision and recall with F-score; scores for each of multiple classes as well as an aggregate; and error distributions (i.e. PR-curve or confusion matrix). <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/solomonm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/solomonm">@solomonm</a> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="12773836" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/1837" data-hovercard-type="issue" data-hovercard-url="/scikit-learn/scikit-learn/issues/1837/hovercard" href="https://github.com/scikit-learn/scikit-learn/issues/1837">#1837</a>) and I (ML, an implementation within <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="11954190" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/1768" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/1768/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/1768">#1768</a>) have independently sought Precision and Recall to be returned from cross-validation routines when F1 is used as the cross-validation objective; <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/eickenberg/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/eickenberg">@eickenberg</a> on <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="8452341" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/1381" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/1381/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/1381#commitcomment-2607318">#1381 (comment)</a> posed a concern regarding array of scores corresponding to multiple targets.</p>
<p dir="auto">I thought it deserved an Issue of its own to solidify the argument and its solution.</p>
<p dir="auto">Some design options:</p>
<ol dir="auto">
<li>Allow multiple scorers to be provided to <code class="notranslate">cross_val_score</code> or <code class="notranslate">*SearchCV</code> (henceforth <code class="notranslate">CVEvaluator</code>), with one specified as the objective. But since the <code class="notranslate">Scorer</code> generally calls <code class="notranslate">estimator.{predict,decision_function,predict_proba}</code>, each scorer would repeat this work.</li>
<li>Separate the objective and non-objective metrics as parameters to <code class="notranslate">CVEvaluator</code>: the <code class="notranslate">scoring</code> parameter remains as it is and a <code class="notranslate">diagnostics</code> parameter provides a callable with similar (same?) arguments as <code class="notranslate">Scorer</code>, but returning a dict. This means that the prediction work is repeated but not necessarily as many times as there are metrics. This diagnostics callable is more flexible and perhaps could be passed the training data as well as the test data.</li>
<li>Continue to use the <code class="notranslate">scoring</code> parameter, but allow the <code class="notranslate">Scorer</code> to return a dict with a special key for the objective score. This would need to be handled by the caller. For backwards compatibility, no existing scorers would change their behaviour of returning a float. This ensures no repeated prediction work.</li>
<li>Add an additional method to the <code class="notranslate">Scorer</code> interface that generates a set of named outputs (as with <code class="notranslate">calc_names</code> proposed in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="12773836" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/1837" data-hovercard-type="issue" data-hovercard-url="/scikit-learn/scikit-learn/issues/1837/hovercard" href="https://github.com/scikit-learn/scikit-learn/issues/1837">#1837</a>), again with a special key for the objective score. This allows users to continue using <code class="notranslate">scoring='f1'</code> but get back precision and recall for free.</li>
</ol>
<p dir="auto">Note that 3. and 4. potentially allow for any set of metrics to be composed into a scorer without redundant prediction work (and 1. allows composition with highly redundant prediction work).</p>
<p dir="auto">Comments, critiques and suggestions are very welcome.</p>