gemseo.mlearning.classification.quality.f1_measure module#

The F1 score to assess the quality of a classifier.

The F1 score is defined by

\[F_1 = 2\frac{\mathit{precision}\times\mathit{recall}} {\mathit{precision}+\mathit{recall}}\]

where \(\mathit{precision}\) is the number of correctly predicted positives divided by the total number of predicted positives and \(\mathit{recall}\) is the number of correctly predicted positives divided by the total number of true positives.

class F1Measure(algo, fit_transformers=True)[source]#

Bases: BaseClassifierQuality

The F1 score to assess the quality of a classifier.

Parameters:
  • algo (BaseClassifier) -- A machine learning algorithm for classification.

  • fit_transformers (bool) --

    Whether to re-fit the transformers when using resampling techniques. If False, use the transformers of the algorithm fitted from the whole training dataset.

    By default it is set to True.

SMALLER_IS_BETTER: ClassVar[bool] = False#

Whether to minimize or maximize the measure.

algo: BaseClassifier#

The machine learning algorithm whose quality we want to measure.