pub struct PreflightJidoka { /* private fields */ }Expand description
Pre-flight Jidoka guard for in-process anomaly detection [49][51].
Unlike post-process JidokaGuard, PreflightJidoka aborts during
computation to prevent wasted work (Muda of Processing).
§Example
use simular::engine::jidoka::{PreflightJidoka, AbortConditions};
let mut preflight = PreflightJidoka::new();
assert!(preflight.check_value(1.0).is_ok());
assert!(preflight.check_value(f64::NAN).is_err());Implementations§
Source§impl PreflightJidoka
impl PreflightJidoka
Sourcepub const fn with_conditions(conditions: AbortConditions) -> Self
pub const fn with_conditions(conditions: AbortConditions) -> Self
Create with custom abort conditions.
Sourcepub const fn with_explosion_threshold(self, threshold: f64) -> Self
pub const fn with_explosion_threshold(self, threshold: f64) -> Self
Set gradient explosion threshold.
Sourcepub const fn with_vanishing_threshold(self, threshold: f64) -> Self
pub const fn with_vanishing_threshold(self, threshold: f64) -> Self
Set gradient vanishing threshold.
Sourcepub const fn with_bounds(self, lower: f64, upper: f64) -> Self
pub const fn with_bounds(self, lower: f64, upper: f64) -> Self
Set value bounds.
Sourcepub fn check_value(&mut self, value: f64) -> SimResult<()>
pub fn check_value(&mut self, value: f64) -> SimResult<()>
Sourcepub fn check_values(&mut self, values: &[f64]) -> SimResult<()>
pub fn check_values(&mut self, values: &[f64]) -> SimResult<()>
Check a slice of values for anomalies.
§Errors
Returns error if any value violates abort conditions.
Sourcepub fn check_gradient_norm(&mut self, norm: f64) -> SimResult<()>
pub fn check_gradient_norm(&mut self, norm: f64) -> SimResult<()>
Check gradient norm for explosion/vanishing.
§Errors
Returns error if gradient is exploding or vanishing.
Sourcepub const fn abort_count(&self) -> u64
pub const fn abort_count(&self) -> u64
Get total abort count.
Sourcepub fn reset_count(&mut self)
pub fn reset_count(&mut self)
Reset abort count.
Trait Implementations§
Source§impl Clone for PreflightJidoka
impl Clone for PreflightJidoka
Source§fn clone(&self) -> PreflightJidoka
fn clone(&self) -> PreflightJidoka
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PreflightJidoka
impl Debug for PreflightJidoka
Auto Trait Implementations§
impl Freeze for PreflightJidoka
impl RefUnwindSafe for PreflightJidoka
impl Send for PreflightJidoka
impl Sync for PreflightJidoka
impl Unpin for PreflightJidoka
impl UnsafeUnpin for PreflightJidoka
impl UnwindSafe for PreflightJidoka
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more