iaf.fit.metrics

Implementation of simple metrics.

iaf.fit.metrics.calc_sse(y: ndarray, y_hat: ndarray)[source]

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 – Sum of squared errors.

Return type:

float

iaf.fit.metrics.calc_sse_weighed(y: ndarray, y_hat: ndarray, se: ndarray)[source]

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 – Weighted sum of squared errors.

Return type:

float

iaf.fit.metrics.r_squared(y: ndarray, y_hat: ndarray)[source]

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 – Coefficient of determination R^2

Return type:

float

iaf.fit.metrics.r_squared_adj(y: ndarray, y_hat: ndarray, p: int)[source]
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 – Adjusted coefficient of determination R^2

Return type:

float