# Measure the quality of a machine learning algorithm¶

## Quality measure¶

The quality_measure module implements the concept of quality measures for machine learning algorithms.

This concept is implemented through the MLQualityMeasure class.

## Error measure¶

The error_measure module implements the concept of error measures for machine learning algorithms.

This concept is implemented through the MLErrorMeasure class and implements the different evaluation methods.

The error measure class is adapted for supervised machine learning algorithms, as it measures the error of a predicted value to some reference value.

## Mean squared error measure¶

The mse_measure module implements the concept of means squared error measures for machine learning algorithms.

This concept is implemented through the MSEMeasure class and overloads the MLErrorMeasure._compute_measure() method.

The mean squared error (MSE) is defined by

$\operatorname{MSE}(\hat{y})=\frac{1}{n}\sum_{i=1}^n(\hat{y}_i-y_i)^2,$

where $$\hat{y}$$ are the predictions and $$y$$ are the data points.

## R2 error measure¶

The r2_measure module implements the concept of R2 measures for machine learning algorithms.

This concept is implemented through the R2Measure class and overloads the MLErrorMeasure._compute_measure() method.

The R2 is defined by

$R_2(\hat{y}) = 1 - \frac{\sum_i (\hat{y}_i - y_i)^2} {\sum_i (y_i-\bar{y})^2},$

where $$\hat{y}$$ are the predictions, $$y$$ are the data points and $$\bar{y}$$ is the mean of $$y$$.