glassbox.metrics.regression¶
Regression metrics (MSE, MAE, R2).
mean_absolute_error
¶
Compute the mean absolute error (MAE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_true
|
ndarray
|
Ground truth target values of shape (n_samples,). |
required |
y_pred
|
ndarray
|
Predicted target values of shape (n_samples,). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Mean absolute error. |
Source code in glassbox/metrics/regression.py
mean_squared_error
¶
Compute the mean squared error (MSE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_true
|
ndarray
|
Ground truth target values of shape (n_samples,). |
required |
y_pred
|
ndarray
|
Predicted target values of shape (n_samples,). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Mean squared error. |
Source code in glassbox/metrics/regression.py
r2_score
¶
Compute the coefficient of determination (R² score).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_true
|
ndarray
|
Ground truth target values of shape (n_samples,). |
required |
y_pred
|
ndarray
|
Predicted target values of shape (n_samples,). |
required |
Returns:
| Type | Description |
|---|---|
float
|
R² score. |
Notes
If y_true is constant, returns 1.0 for perfect predictions and 0.0 otherwise.