holisticai.bias.metrics.rmse_ratio#
- holisticai.bias.metrics.rmse_ratio(group_a, group_b, y_pred, y_true, q=0)[source]#
RMSE ratio
This function computes the ratio of the RMSE for group_a and group_b.
If q is a vector, this function returns a vector with the respective result for each given quantile in q.
A value of 1 is desired. Lower values show bias against group_a. Higher values show bias against group_b.
- group_aarray-like
Group membership vector (binary)
- group_barray-like
Group membership vector (binary)
- y_predarray-like
Predictions vector (regression)
- y_truenumpy array
Target vector (regression)
- qfloat, array-like, optional
quantile of predictions considered, default=0.
- float
RMSE ratio
:math:`
rac{RMSE_a}{RMSE_b}`
>>> import numpy as np >>> from holisticai.bias.metrics import rmse_ratio >>> group_a = np.array([1] * 50 + [0] * 50) >>> group_b = np.array([0] * 50 + [1] * 50) >>> y_pred = np.concatenate((np.linspace(-1, 1, 50), np.linspace(-1, 1, 50))) >>> y_true = np.concatenate( ... (np.linspace(-1, 1, 50) ** 2, np.linspace(-1, 1, 50) ** 3) ... ) >>> rmse_ratio(group_a, group_b, y_pred, y_true) 2.7471209467641367