Skip to content

metrics

Functions:

NameDescription
validate_and_promoteValidate shape match and promote 1D to 2D.
rhosPearson correlation per dimension.
mean_rhoMean Pearson correlation.
rmseRoot Mean Squared Error.
maeMean Absolute Error.

Attributes:

NameTypeDescription
MetricFuncTypeAliasMetricFunc is a function that takes (predictions, observations) and returns a metric value.
MetricFunc: TypeAlias = Callable[[np.ndarray, np.ndarray], np.ndarray]

MetricFunc is a function that takes (predictions, observations) and returns a metric value.

validate_and_promote(predictions: np.ndarray, observations: np.ndarray) -> tuple[np.ndarray, np.ndarray]

Validate shape match and promote 1D to 2D.

rhos(predictions: np.ndarray, observations: np.ndarray) -> np.ndarray

Pearson correlation per dimension.

Parameters:

NameTypeDescriptionDefault
predictionsndarray(N,), (N, D), or (B, N, D).required
observationsndarraySame shape as predictions.required

Returns:

TypeDescription
ndarray(1,) for 1D input, (D,) for 2D, (B, D) for 3D.
mean_rho(predictions: np.ndarray, observations: np.ndarray) -> np.ndarray

Mean Pearson correlation.

Parameters:

NameTypeDescriptionDefault
predictionsndarray(N,), (N, D), or (B, N, D).required
observationsndarraySame shape as predictions.required

Returns:

TypeDescription
ndarray() for 1D/2D input, (B,) for 3D input.
rmse(predictions: np.ndarray, observations: np.ndarray) -> np.ndarray

Root Mean Squared Error.

Parameters:

NameTypeDescriptionDefault
predictionsndarray(N,), (N, D), or (B, N, D).required
observationsndarraySame shape as predictions.required

Returns:

TypeDescription
ndarray() for 1D/2D input, (B,) for 3D input.
mae(predictions: np.ndarray, observations: np.ndarray) -> np.ndarray

Mean Absolute Error.

Parameters:

NameTypeDescriptionDefault
predictionsndarray(N,), (N, D), or (B, N, D).required
observationsndarraySame shape as predictions.required

Returns:

TypeDescription
ndarray() for 1D/2D input, (B,) for 3D input.