API CheatSheet
The following APIs are applicable for all detector models for ease of use.
pythresh.thresholders.base.BaseDetector.eval()
: evaluate a single outlier or multiple outlier detection likelihood score sets
Key Attributes of a fitted model:
pythresh.thresholds.base.BaseThresholder.thresh_
: threshold value from scores normalize between 0 and 1pythresh.thresholders.base.BaseDetector.confidence_interval_
: Return the lower and upper confidence interval of the contamination level. Only applies to the COMB thresholderpythresh.thresholders.base.BaseDetector.dscores_
: 1D array of the TruncatedSVD decomposed decision scores if multiple outlier detector score sets are passedpythresh.thresholders.mixmod.MIXMOD.mixture_
: fitted mixture model class of the selected model used for thresholding. Only applies to MIXMOD. Attributes include: components, weights, params. Functions include: fit, loglikelihood, pdf, and posterior.
See base class definition below:
pythresh.thresholds.base module
- class pythresh.thresholds.base.BaseThresholder[source]
Bases:
object
Abstract class for all outlier detection thresholding algorithms.
- thresh_
- Type:
threshold value that separates inliers from outliers
- confidence_interval_
- Type:
lower and upper confidence interval of the contamination level
- dscores_
- Type:
1D array of decomposed decision scores
- abstract eval(decision)[source]
Outlier/inlier evaluation process for decision scores.
- Parameters:
decision (np.array or list of shape (n_samples)) – or np.array of shape (n_samples, n_detectors) which are the decision scores from a outlier detection.
- Returns:
outlier_labels – For each observation, tells whether or not it should be considered as an outlier according to the fitted model. 0 stands for inliers and 1 for outliers.
- Return type:
numpy array of shape (n_samples,)