pub struct MADDetector { /* private fields */ }Expand description
A detector using the Median Absolute Deviation (MAD) to detect outliers.
Implementations§
Source§impl MADDetector
impl MADDetector
Sourcepub fn with_threshold(threshold: f64) -> MADDetector
pub fn with_threshold(threshold: f64) -> MADDetector
Create a new MAD detector with the given threshold.
Sourcepub fn with_sensitivity(sensitivity: f64) -> Result<MADDetector, Error>
pub fn with_sensitivity(sensitivity: f64) -> Result<MADDetector, Error>
Create a new MAD detector with the given sensitivity.
At detection-time, a sensible value for threshold will be calculated
using the scale of the data and the sensitivity value.
Sourcepub fn set_threshold(&mut self, threshold: f64)
pub fn set_threshold(&mut self, threshold: f64)
Set threshold for the MAD detector.
§Example
use augurs::outlier::MADDetector;
let mut detector = MADDetector::with_threshold(1.0);
detector.set_threshold(3.0);Sourcepub fn set_sensitivity(&mut self, sensitivity: f64) -> Result<(), Error>
pub fn set_sensitivity(&mut self, sensitivity: f64) -> Result<(), Error>
Set sensitivity for the MAD detector.
§Example
use augurs::outlier::MADDetector;
let mut detector = MADDetector::with_sensitivity(0.5).expect("sensitivity is between 0.0 and 1.0");
detector.set_sensitivity(0.1).expect("sensitivity is between 0.0 and 1.0");Sourcepub fn set_medians(&mut self, medians: Medians)
pub fn set_medians(&mut self, medians: Medians)
Set the precalculated medians.
The medians can be calculated using MADDetector::calculate_double_medians.
Sourcepub fn calculate_double_medians(
data: &[&[f64]],
) -> Result<Medians, PreprocessingError>
pub fn calculate_double_medians( data: &[&[f64]], ) -> Result<Medians, PreprocessingError>
Calculate the medians of the unprocessed data.
This can be used to precalculate the medians of a larger set of data, for example.
§Errors
Returns an error if the data is empty, contains only NaNs, or if the lower or upper median is 0.0.
Trait Implementations§
Source§impl Clone for MADDetector
impl Clone for MADDetector
Source§fn clone(&self) -> MADDetector
fn clone(&self) -> MADDetector
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 MADDetector
impl Debug for MADDetector
Source§impl OutlierDetector for MADDetector
impl OutlierDetector for MADDetector
Source§type PreprocessedData = PreprocessedData
type PreprocessedData = PreprocessedData
The preprocessed data used by the outlier detection algorithm. Read more
Source§fn preprocess(
&self,
y: &[&[f64]],
) -> Result<<MADDetector as OutlierDetector>::PreprocessedData, Error>
fn preprocess( &self, y: &[&[f64]], ) -> Result<<MADDetector as OutlierDetector>::PreprocessedData, Error>
Preprocess the given slice of series. Read more
Source§fn detect(
&self,
y: &<MADDetector as OutlierDetector>::PreprocessedData,
) -> Result<OutlierOutput, Error>
fn detect( &self, y: &<MADDetector as OutlierDetector>::PreprocessedData, ) -> Result<OutlierOutput, Error>
Detect outliers in the given slice of series. Read more
Auto Trait Implementations§
impl Freeze for MADDetector
impl RefUnwindSafe for MADDetector
impl Send for MADDetector
impl Sync for MADDetector
impl Unpin for MADDetector
impl UnsafeUnpin for MADDetector
impl UnwindSafe for MADDetector
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.