pub struct DynamicForest<const MAX_D: usize> { /* private fields */ }Expand description
Runtime-dim facade over RandomCutForest<MAX_D>. MAX_D must
be at compile time ≥ the widest active_dim the caller will
ever feed.
Implementations§
Source§impl<const MAX_D: usize> DynamicForest<MAX_D>
impl<const MAX_D: usize> DynamicForest<MAX_D>
Sourcepub fn new(builder: ForestBuilder<MAX_D>, active_dim: usize) -> RcfResult<Self>
pub fn new(builder: ForestBuilder<MAX_D>, active_dim: usize) -> RcfResult<Self>
Build from a prepared ForestBuilder<MAX_D>.
§Errors
RcfError::InvalidConfigwhenactive_dim == 0oractive_dim > MAX_D.- Propagates
ForestBuilder::buildfailures.
Sourcepub fn active_dim(&self) -> usize
pub fn active_dim(&self) -> usize
Active dim of this facade — every input slice must have this length.
Sourcepub fn forest(&self) -> &RandomCutForest<MAX_D>
pub fn forest(&self) -> &RandomCutForest<MAX_D>
Read-only handle to the underlying const-generic forest — useful for inspecting metrics / persistence state.
Sourcepub fn score(&self, point: &[f64]) -> RcfResult<AnomalyScore>
pub fn score(&self, point: &[f64]) -> RcfResult<AnomalyScore>
Score a runtime-sized point. Returns
RcfError::DimensionMismatch when point.len() != active_dim.
§Errors
RcfError::DimensionMismatchon length mismatch.RcfError::NaNValueon non-finite components.- Propagates
RandomCutForest::scorefailures.
Sourcepub fn update(&mut self, point: &[f64]) -> RcfResult<()>
pub fn update(&mut self, point: &[f64]) -> RcfResult<()>
Fold a runtime-sized point into the forest.
§Errors
Same as Self::score plus RandomCutForest::update
failures.
Sourcepub fn attribution(&self, point: &[f64]) -> RcfResult<DiVector>
pub fn attribution(&self, point: &[f64]) -> RcfResult<DiVector>
Attribution for a runtime-sized point. Returns a
DiVector of active_dim entries (the zero-padded tail
is truncated from the output).
§Errors
Same as Self::score plus RandomCutForest::attribution
failures.
Trait Implementations§
Auto Trait Implementations§
impl<const MAX_D: usize> Freeze for DynamicForest<MAX_D>
impl<const MAX_D: usize> !RefUnwindSafe for DynamicForest<MAX_D>
impl<const MAX_D: usize> Send for DynamicForest<MAX_D>
impl<const MAX_D: usize> Sync for DynamicForest<MAX_D>
impl<const MAX_D: usize> Unpin for DynamicForest<MAX_D>
impl<const MAX_D: usize> UnsafeUnpin for DynamicForest<MAX_D>
impl<const MAX_D: usize> !UnwindSafe for DynamicForest<MAX_D>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more