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 data y.

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 data y weighed by the standard error vector se.

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 vectors y_hat and y.

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 vectors y_hat and y and number of parameters p.

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