Control Metrics#

Control Metrics#

Stability and responsiveness metrics for dynamic systems.

Provided metrics#

  • overshoot: maximum relative overshoot of the response over the target.

  • settling_time: samples required to remain within a tolerance band.

  • robustness: inverse sensitivity to disturbances (MSE-based).

qmlhc.metrics.control.overshoot(y_true, y_pred)[source]#

Maximum relative overshoot of the response over the reference.

The metric is computed as: max(0, max(y_pred) - max(y_true)) / |max(y_true)|. If the reference maximum is zero, returns 0.0.

Parameters:
  • y_true (TensorLike) – Reference/target signal, shape (T,).

  • y_pred (TensorLike) – Response/prediction signal, shape (T,).

Returns:

Relative overshoot (unitless, >= 0).

Return type:

float

qmlhc.metrics.control.robustness(y_true, y_pred)[source]#

Inverse sensitivity to disturbances based on mean squared error.

Defined as 1 / (1 + MSE(y_true, y_pred)). Values lie in (0, 1], where larger is better (more robust).

Parameters:
  • y_true (TensorLike) – Reference/target signal, shape (T,).

  • y_pred (TensorLike) – Response/prediction signal, shape (T,).

Returns:

Robustness score in (0, 1].

Return type:

float

qmlhc.metrics.control.settling_time(y_true, y_pred, tol=0.05)[source]#

Samples until the response stays within a tolerance band around the target.

The tolerance band is defined around the final target value: [ref*(1 - tol), ref*(1 + tol)], where ref = y_true[-1]. The function scans backward and returns the last index violating the band, plus one. If the entire sequence is within band, returns 0.

Parameters:
  • y_true (TensorLike) – Reference/target signal, shape (T,).

  • y_pred (TensorLike) – Response/prediction signal, shape (T,).

  • tol (float, optional) – Relative tolerance (e.g., 0.05 for ±5%), by default 0.05.

Returns:

Settling time in samples.

Return type:

int