-
Notifications
You must be signed in to change notification settings - Fork 14
Documentation
Welcome to the multiscorer wiki!
This is the complete API documentation. For examples of use see Examples Wiki.
Use this class to encapsulate and/or aggregate multiple scoring functions so that it can be passed as an argument for scoring in scikit's cross_val_score function.
Instances of this class are also callables, with signature as needed by cross_val_score.
-
Get a new instance of
MultiScorer.-
-
metrics:
dict
The metrics to be used by the scorer.
The dictionary must have as key a name (str) for the metric and as value a tuple containing the metric function itself and a dict literal of the additional named arguments to be passed to the function.
The metric function should be one of thesklearn.metricsfunction or any other callable with the same signature:metric(y_real, y, **kwargs).
-
metrics:
-
-
To be called by for evaluation from sklearn's
GridSearchCVorcross_val_score.-
- ...as defined in the respective documentation.
-
-
dummy :
int(0.5)
A dummy value of 0.5 just for compatibility reasons.
-
dummy :
-
-
Get all the metric names as given when initialized.
-
-
metric_names :
list
A list containing the given names of the metrics.
-
metric_names :
-
Get the results of a specific or all the metrics. This method should be called after the object itself has been called so that the metrics are applied.
-
-
metric:
strorNone(default)
The given name of a metric to return its result(s). If omitted the results of all metrics will be returned. -
fold :
intin range [1, number_of_folds] or 'all' (Default)
Get the metric(s) results for the specific fold.
The number of folds corresponds to the number of times the instance is called.
If its value is a number, either the score of a single metric for that fold or a dictionary of the (single) scores for that fold will be returned, depending on the value ofmetricparameter.
If its value is 'all', either a list of a single metric or a dictionary containing the lists of scores for all folds will be returned, depending on the value ofmetricparameter.
-
metric:
-
-
metric_result_for_one_fold
The result of the designated metric function for the specific fold, ifmetricparameter was not omitted and an integer value was given tofoldparameter.
If the value ofmetricdoes not correspond to a metric name,Nonewill be returned. -
all_metric_results_for_one_fold:
dict
A dict having as keys the names of the metrics and as values their results for the specific fold.
This will be returned only ifmetricparameter was omitted and an integer value was given tofoldparameter. -
metric_results_for_all_folds:
list
A list of length number_of_folds containing the results of all folds for the specific metric, ifmetricparameter was not omitted and value 'all' was given tofold.
If the value ofmetricdoes not correspond to a metric name,Nonewill be returned. -
all_metric_results_for_all_folds:
dictwith lists as values
A dict having as keys the names of the metrics and as values lists (of length number_of_folds) of their results for all folds.
This will be returned only ifmetricparameter was omitted and 'all' value was given tofoldparameter.
-
metric_result_for_one_fold
-
-
UserWarning
If this method is called before the instance is called for evaluation. -
ValueError
If the value forfoldparameter is not appropriate.
-
UserWarning
-
Note: number_of_folds is not an actual variable / constant or parameter, it just indicates how many times the instance is called (possibly by scikit's cross_val_score), thus creating lists of that length.