pub struct ModelHealthReport { /* private fields */ }Expand description
Snapshot of model parameter health.
Computed from a flat slice of weights and an optional intercept. Detects NaN / Infinity contamination and reports basic weight statistics. Does not store the parameters themselves.
§Examples
use rill_ml::diagnostics::ModelHealthReport;
let report = ModelHealthReport::from_parameters(&[0.1, -0.2, 0.5], Some(1.0));
assert_eq!(report.parameter_count(), 4);
assert!(report.is_healthy());
assert_eq!(report.weight_range(), Some(1.2));Implementations§
Source§impl ModelHealthReport
impl ModelHealthReport
Sourcepub fn from_parameters(weights: &[f64], intercept: Option<f64>) -> Self
pub fn from_parameters(weights: &[f64], intercept: Option<f64>) -> Self
Build a report by scanning a slice of weights plus an optional intercept.
parameter_count = weights.len() + intercept.is_some() as usize.
state_size_bytes = parameter_count * 8 (one f64 per parameter).
Empty input yields weight_min == weight_max == None and a healthy
report (no NaN / Infinity detected).
Sourcepub const fn parameter_count(&self) -> usize
pub const fn parameter_count(&self) -> usize
Total number of parameters (weights plus optional intercept).
Sourcepub const fn weight_min(&self) -> Option<f64>
pub const fn weight_min(&self) -> Option<f64>
Minimum weight value, or None if no parameters were supplied.
Sourcepub const fn weight_max(&self) -> Option<f64>
pub const fn weight_max(&self) -> Option<f64>
Maximum weight value, or None if no parameters were supplied.
Sourcepub const fn has_infinity(&self) -> bool
pub const fn has_infinity(&self) -> bool
Whether any parameter is positive or negative Infinity.
Sourcepub const fn state_size_bytes(&self) -> usize
pub const fn state_size_bytes(&self) -> usize
Estimated state size in bytes (parameter_count * 8).
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Whether the parameters are free of NaN and Infinity.
Sourcepub fn weight_range(&self) -> Option<f64>
pub fn weight_range(&self) -> Option<f64>
Spread of weights (weight_max - weight_min), or None if no data.
Trait Implementations§
Source§impl Clone for ModelHealthReport
impl Clone for ModelHealthReport
Source§fn clone(&self) -> ModelHealthReport
fn clone(&self) -> ModelHealthReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more