tempor.metrics.prediction.one_off.plugin_builtin_classification module

Module with built-in metric plugins for the category: prediction -> one-off -> classification.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.AccuracyOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Accuracy classification score.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'accuracy'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.F1ScoreMicroOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

F1 score is a harmonic mean of the precision and recall. This version uses the "micro" average: calculate metrics globally by counting the total true positives, false negatives and false positives.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'f1_score_micro'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.F1ScoreMacroOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

F1 score is a harmonic mean of the precision and recall. This version uses the "macro" average: calculate metrics for each label, and find their unweighted mean. This does not take label imbalance into account.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'f1_score_macro'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.F1ScoreWeightedOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

F1 score is a harmonic mean of the precision and recall. This version uses the "weighted" average: calculate metrics for each label, and find their average weighted by support (the number of true instances for each label).

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'f1_score_weighted'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.KappaOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Computes Cohen’s kappa, a score that expresses the level of agreement between two annotators on a classification problem.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'kappa'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.KappaQuadraticOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Computes Cohen’s kappa, a score that expresses the level of agreement between two annotators on a classification problem. Weighted using the "quadratic" weighting.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'kappa_quadratic'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.RecallMicroOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Recall is defined as the number of true positives over the number of true positives plus the number of false negatives. This version (micro) calculates metrics globally by counting the total true positives.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'recall_micro'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.RecallMacroOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Recall is defined as the number of true positives over the number of true positives plus the number of false negatives. This version (macro) calculates metrics for each label, and finds their unweighted mean.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'recall_macro'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.RecallWeightedOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Recall is defined as the number of true positives over the number of true positives plus the number of false negatives. This version(weighted) calculates metrics for each label, and find their average weighted by support.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'recall_weighted'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.PrecisionMicroOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Precision is defined as the number of true positives over the number of true positives plus the number of false positives. This version (micro) calculates metrics globally by counting the total true positives.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'precision_micro'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.PrecisionMacroOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Precision is defined as the number of true positives over the number of true positives plus the number of false positives. This version (macro) calculates metrics for each label, and finds their unweighted mean.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'precision_macro'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.PrecisionWeightedOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

Precision is defined as the number of true positives over the number of true positives plus the number of false positives. This version (weighted) calculates metrics for each label, and find their average weighted by support.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'precision_weighted'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.MccOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

The Matthews Correlation Coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It takes into account true and false positives and negatives and is generally regarded as a balanced measure which can be used even if the classes are of very different sizes.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'mcc'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.AucPrcOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

The average precision summarizes a precision-recall curve as the weighted mean of precisions achieved at each threshold, with the increase in recall from the previous threshold used as the weight.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'aucprc'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.

class tempor.metrics.prediction.one_off.plugin_builtin_classification.AucRocOneOffClassificationMetric[source]

Bases: OneOffClassificationMetric

The Area Under the Receiver Operating Characteristic Curve (ROC AUC) from prediction scores.

The base class that all plugins must inherit from.

property direction : Literal[minimize] | Literal[maximize]

The direction of the metric

category : ClassVar[str] = 'prediction.one_off.classification'

Plugin category, such as 'prediction.one_off.classification'. Must be set by the plugin class using @register_plugin.

name : ClassVar[str] = 'aucroc'

Plugin name, such as 'my_nn_classifier'. Must be set by the plugin class using @register_plugin.

plugin_type : ClassVar[None | Literal[all] | str] = 'metric'

Plugin type, such as 'method'. May be optionally set by the plugin class using @register_plugin, else will set the default plugin type.