Skip to contents

Scores one or more new samples against the calibrated conformal anomaly model from fit_conformal_anomaly. The conformal p-value is the fraction of calibration scores at least as extreme as the test score: $$p = \frac{1 + \#\{s_{\mathrm{cal}} \geq s_{\mathrm{test}}\}}{1 + n_{\mathrm{cal}}}.$$

Usage

os_conformal_anomaly(x, fit, alpha = 0.05)

Arguments

x

Numeric vector or matrix (samples \(\times\) features).

fit

A conformal_anomaly_fit object from fit_conformal_anomaly.

alpha

Significance level for the binary anomaly call. Default 0.05.

Value

List with score (raw k-NN distance), p_value (conformal p in \([0,1]\)), is_anomaly (logical at level alpha), alpha, and calibration_summary.