Given two numeric matrices Xtrue and Xrec, compute:
MSE ("mse")
RMSE ("rmse")
R^2 ("r2")
MAE ("mae")
measure_reconstruction_error(
Xtrue,
Xrec,
metrics = c("mse", "rmse", "r2"),
by_column = FALSE
)A one-row tibble with columns matching metrics.
Original data matrix, shape (n x p).
Reconstructed data matrix, shape (n x p).
Character vector of metric names, e.g. c("mse","rmse","r2","mae").
Logical, if TRUE calculate R2 metric per column and average (default: FALSE).