pub struct FeatureSketch { /* private fields */ }Expand description
Sparse feature-name sketch detector for schema-evolving streams.
score() previews the current anomaly score without mutating detector
state. update() teaches the detector and advances the internal event
counter. Scores are higher for more anomalous events.
Implementations§
Source§impl FeatureSketch
impl FeatureSketch
Sourcepub fn builder() -> FeatureSketchBuilder
pub fn builder() -> FeatureSketchBuilder
Create a builder with the documented default configuration.
Sourcepub fn from_config(config: &FeatureSketchConfig) -> Result<Self>
pub fn from_config(config: &FeatureSketchConfig) -> Result<Self>
Build directly from config with a random seed.
Sourcepub fn from_config_seeded(
config: &FeatureSketchConfig,
seed: u64,
) -> Result<Self>
pub fn from_config_seeded( config: &FeatureSketchConfig, seed: u64, ) -> Result<Self>
Build directly from config with an explicit deterministic seed.
Sourcepub fn config(&self) -> &FeatureSketchConfig
pub fn config(&self) -> &FeatureSketchConfig
Return the detector configuration.
Sourcepub fn entries_seen(&self) -> u64
pub fn entries_seen(&self) -> u64
Return the number of processed events.
Sourcepub fn score<I, N>(&self, features: I) -> Result<f64>
pub fn score<I, N>(&self, features: I) -> Result<f64>
Preview the anomaly score for an event without mutating detector state.
Sourcepub fn update<I, N>(&mut self, features: I) -> Result<()>
pub fn update<I, N>(&mut self, features: I) -> Result<()>
Ingest a feature event without returning its score.
Sourcepub fn update_and_score<I, N>(&mut self, features: I) -> Result<f64>
pub fn update_and_score<I, N>(&mut self, features: I) -> Result<f64>
Sourcepub fn from_json(json: impl AsRef<[u8]>) -> Result<Self>
pub fn from_json(json: impl AsRef<[u8]>) -> Result<Self>
Deserialize detector state from JSON previously written by Self::to_json.
Trait Implementations§
Source§impl Clone for FeatureSketch
impl Clone for FeatureSketch
Source§fn clone(&self) -> FeatureSketch
fn clone(&self) -> FeatureSketch
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 FeatureSketch
impl Debug for FeatureSketch
Source§impl<'de> Deserialize<'de> for FeatureSketch
impl<'de> Deserialize<'de> for FeatureSketch
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FeatureSketch
impl RefUnwindSafe for FeatureSketch
impl Send for FeatureSketch
impl Sync for FeatureSketch
impl Unpin for FeatureSketch
impl UnsafeUnpin for FeatureSketch
impl UnwindSafe for FeatureSketch
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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