pub struct ShiftDetector { /* private fields */ }Implementations§
Source§impl ShiftDetector
impl ShiftDetector
Sourcepub fn from_dataset(dataset: &BinnedDataset) -> Self
pub fn from_dataset(dataset: &BinnedDataset) -> Self
Create a detector from a training BinnedDataset
Pre-computes histograms from the training data for efficient comparison with inference data.
Uses dynamic histogram sizing based on each feature’s actual num_bins
to minimize memory usage (vs fixed 256-bin arrays).
Sourcepub fn from_raw(
features: &[f32],
num_features: usize,
feature_names: Option<&[String]>,
) -> Self
pub fn from_raw( features: &[f32], num_features: usize, feature_names: Option<&[String]>, ) -> Self
Create from raw feature data
§Arguments
features- Row-major feature matrixnum_features- Number of featuresfeature_names- Optional feature names
Note: Raw data uses MAX_HISTOGRAM_BINS (256) since actual bin count is unknown.
For memory efficiency with binned data, use from_dataset instead.
Sourcepub fn with_thresholds(self, warning: f32, critical: f32) -> Self
pub fn with_thresholds(self, warning: f32, critical: f32) -> Self
Set custom thresholds
Sourcepub fn with_metric<M: DistributionMetric + 'static>(self, metric: M) -> Self
pub fn with_metric<M: DistributionMetric + 'static>(self, metric: M) -> Self
Set a custom distribution metric
Sourcepub fn check(&self, inference_data: &BinnedDataset) -> ShiftResult
pub fn check(&self, inference_data: &BinnedDataset) -> ShiftResult
Check inference data for distribution shift
Compares each feature’s distribution in the inference data against the reference (training) distribution. Automatically adjusts thresholds based on sample size differences.
Uses dynamic histogram sizing matching reference histograms for memory efficiency.
Sourcepub fn feature_info(&self) -> &[FeatureInfo]
pub fn feature_info(&self) -> &[FeatureInfo]
Get reference feature info
Sourcepub fn warning_threshold(&self) -> f32
pub fn warning_threshold(&self) -> f32
Get the warning threshold
Sourcepub fn critical_threshold(&self) -> f32
pub fn critical_threshold(&self) -> f32
Get the critical threshold
Sourcepub fn metric_name(&self) -> &'static str
pub fn metric_name(&self) -> &'static str
Get the metric name
Auto Trait Implementations§
impl Freeze for ShiftDetector
impl !RefUnwindSafe for ShiftDetector
impl Send for ShiftDetector
impl Sync for ShiftDetector
impl Unpin for ShiftDetector
impl !UnwindSafe for ShiftDetector
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
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> ⓘ
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.