Performance metrics¶
- torchid.metrics.r_squared(y_true, y_pred, time_axis=0)[source]¶
Computes the R-square index.
The R-squared index is computed separately on each channel.
- Parameters:
y_true (np.array) – Array of true values. If must be at least 2D.
y_pred (np.array) – Array of predicted values. If must be compatible with y_true’
time_axis (int) – Time axis. All other axes define separate channels.
- Returns:
r_squared_val – Array of r_squared value.
- Return type:
np.array
- torchid.metrics.rmse(y_true, y_pred, time_axis=0)[source]¶
Computes the Root Mean Square Error (RMSE).
The RMSE index is computed separately on each channel.
- Parameters:
y_true (np.array) – Array of true values. If must be at least 2D.
y_pred (np.array) – Array of predicted values. If must be compatible with y_true’
time_axis (int) – Time axis. All other axes define separate channels.
- Returns:
RMSE – Array of r_squared value.
- Return type:
np.array
- torchid.metrics.nrmse(y_true, y_pred, time_axis=0)[source]¶
Computes the Normalized Root Mean Square Error (NRMSE).
The NRMSE index is computed separately on each channel.
- Parameters:
y_true (np.array) – Array of true values. If must be at least 2D.
y_pred (np.array) – Array of predicted values. If must be compatible with y_true’
time_axis (int) – Time axis. All other axes define separate channels.
- Returns:
NRMSE – Array of r_squared value.
- Return type:
np.array
- torchid.metrics.error_mean(y_true, y_pred, time_axis=0)[source]¶
Computes the error mean value.
The error mean is computed separately on each channel.
- Parameters:
y_true (np.array) – Array of true values. If must be at least 2D.
y_pred (np.array) – Array of predicted values. If must be compatible with y_true’
time_axis (int) – Time axis. All other axes define separate channels.
- Returns:
e_mean – Array of error means.
- Return type:
np.array
- torchid.metrics.mae(y_true, y_pred, time_axis=0)[source]¶
Computes the error Mean Absolute Value (MAE)
The MAE index is computed separately on each channel.
- Parameters:
y_true (np.array) – Array of true values. If must be at least 2D.
y_pred (np.array) – Array of predicted values. If must be compatible with y_true’
time_axis (int) – Time axis. All other axes define separate channels.
- Returns:
e_mae – Array of error mean absolute values.
- Return type:
np.array
- torchid.metrics.fit_index(y_true, y_pred, time_axis=0)[source]¶
Computes the per-channel fit index.
The fit index is commonly used in System Identification. See the definition in the System Identification Toolbox or in the paper ‘Nonlinear System Identification: A User-Oriented Road Map’, https://arxiv.org/abs/1902.00683, page 31. The fit index is computed separately on each channel.
- Parameters:
y_true (np.array) – Array of true values. If must be at least 2D.
y_pred (np.array) – Array of predicted values. If must be compatible with y_true’
time_axis (int) – Time axis. All other axes define separate channels.
- Returns:
fit – Array of fit index.
- Return type:
np.array