Module iaf.fit.metrics
Implementation of simple metrics.
Functions
def calc_sse(y: numpy.ndarray, y_hat: numpy.ndarray)
-
Calculate the Sum of Squared Errors between prediction
y_hat
and datay
.Parameters
y
:np.ndarray
- Array of target values.
y_hat
:np.ndarray
- Array of predicted values.
Returns
sse
:float
- Sum of squared errors.
def calc_sse_weighed(y: numpy.ndarray, y_hat: numpy.ndarray, se: numpy.ndarray)
-
Calculate the Sum of Squared Errors between prediction
y_hat
and datay
weighed by the standard error vectorse
.Parameters
y
:np.ndarray
- Array of target values.
y_hat
:np.ndarray
- Array of predicted values.
se
:np.ndarray
- Array of standard error values.
Returns
sse
:float
- Weighted sum of squared errors.
def r_squared(y: numpy.ndarray, y_hat: numpy.ndarray)
-
Calculate the coefficient of determination
R^2
for vectorsy_hat
andy
.Parameters
y
:np.ndarray
- Array of target values.
y_hat
:np.ndarray
- Array of predicted values.
Returns
r_squared
:float
- Coefficient of determination
R^2
def r_squared_adj(y: numpy.ndarray, y_hat: numpy.ndarray, p: int)
-
Calculate the adjusted coefficient of determination
R^2
for vectorsy_hat
andy
and number of parametersp
.Parameters
y
:np.ndarray
- Array of target values.
y_hat
:np.ndarray
- Array of predicted values.
p
:int
- Number of parameters.
Returns
r_squared
:float
- Adjusted coefficient of determination
R^2