qlroms.utils.metrics
Lightweight diagnostic metrics used to compare ROM trajectories against the FOM.
relative_error_series(X_ref, X_approx, eps=1e-12)
Per-snapshot relative error of (N, T) column-trajectory tensors (torch).
Source code in qlroms/utils/metrics.py
75 76 77 78 79 80 81 82 83 84 85 86 | |
one_step_errors_series(X, model)
Open-loop one-step-ahead error: at every snapshot i, step the model ONE step forward from the TRUE state x_i (not from its own previous prediction) and compare to the TRUE next snapshot x_{i+1}. Unlike a free multi-step run, errors here cannot accumulate across steps -- this isolates the one-step fit quality itself (and, for a quantized-local model, shows up as error spikes right at cluster-boundary snapshots).
Source code in qlroms/utils/metrics.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
reconstruction_error_series(X, model)
Pure POD projection+reconstruction relative error per snapshot -- NO dynamics/ time-stepping: for the nearest cluster k, a = Phi_k^T Mw (x - c_k), x_hat = c_k + Phi_k a. Isolates how well the fitted basis alone represents each snapshot, independent of the model's fitted dynamics (contrast one_step_errors_series).
Source code in qlroms/utils/metrics.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
prediction_horizon(rel_err, dt, threshold=0.5)
First time (in physical units) at which rel_err exceeds threshold, matching
the ql-ROM papers' T_ph definition (normalized-error threshold, default tau=0.5).
Source code in qlroms/utils/metrics.py
132 133 134 135 136 137 | |