xenonpy.model.utils package
Submodules
xenonpy.model.utils.metrics module
- xenonpy.model.utils.metrics.classification_metrics(y_true, y_pred, *, average=('weighted', 'micro', 'macro'), labels=None)[source]
Calculate most common classification scores. See also: https://scikit-learn.org/stable/modules/model_evaluation.html
- Parameters:
average (
Union
[None
,List
[str
],Tuple
[str
]]) –This parameter is required for multiclass/multilabel targets. If None, the scores for each class are returned. Otherwise, this determines the type of averaging performed on the data:
- binary:
Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary.
- micro:
Calculate metrics globally by counting the total true positives, false negatives and false positives.
- macro:
Calculate metrics for each label, and find their unweighted mean. This does not take label imbalance into account.
- weighted:
Calculate metrics for each label, and find their average weighted by support (the number of true instances for each label). This alters
macro
to account for label imbalance; it can result in an F-score that is not between precision and recall.
labels – The set of labels to include when average !=
binary
, and their order if average is None. Labels present in the data can be excluded, for example to calculate a multiclass average ignoring a majority negative class, while labels not present in the data will result in 0 components in a macro average. For multilabel targets, labels are column indices. By default, all labels in y_true and y_pred are used in sorted order.
- Returns:
An
collections.OrderedDict
contains classification scores. These scores will always containsaccuracy
,f1
,precision
andrecall
. For multilabel targets, based on the selection of theaverage
parameter, the weighted, micro, and macro scores off1`, ``precision
, andrecall
will be calculated.- Return type:
OrderedDict
- xenonpy.model.utils.metrics.regression_metrics(y_true, y_pred)[source]
Calculate most common regression scores. See Also: https://scikit-learn.org/stable/modules/model_evaluation.html