2012/10/24 Mathieu Blondel <[email protected]>:
> On Wed, Oct 24, 2012 at 10:00 PM, Andreas Mueller <[email protected]>
> wrote:
>>
>> Maybe the question was more "why does the user want to know that?"
>> If it is called as
>> RocAreaUnderCurveScore()(est, y_true, y_pred)
>> why does the user need to discover how this is computed?
>
>
> One use case would be error-handling. For example:
>
> [in a classifier]
> def score(self, X, y, metric=None):
> metric = get_metric(metric) # handle None / string
> if not ininstance(metric, ClassificationMetric):
> raise ValueError
>
> or
>
> if not metric.classication_metric:
> raise ValueError
Let's do more permissive duck / flag typing using getattr instead:
if not getattr(metric, 'classification_metric', False):
raise ValueError('%s does not support classification' % metric)
--
Olivier
http://twitter.com/ogrisel - http://github.com/ogrisel
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general