consistent_ocsvm: Consistency based tuning OCSVM

Description Usage Arguments Value References Examples

View source: R/consistent_ocsvm.R

Description

The complexity of model is increased until the classifier becomes inconsistent on the data. Thus, the most complex classifier is selected that can still be trained reliably on the data. This is a translation of the code found in the inconsistency_occ function of the MATLAB dd_toolbox (http://prlab.tudelft.nl/david-tax/dd_tools.html). For more information, see also Tax & Mueller (2004).

Usage

1
2
3
4
consistent_ocsvm(x, target_fnr = 0.1, sigmas = 2^seq(-8, 7), k = 10,
  sigma_thr = 2, seed = NULL, selectLastConsistent = FALSE,
  oneMoreComplexity = TRUE, refineGrid = FALSE, refineFun = function(rng)
  seq(rng[1], rng[2], length.out = 10), verbose = TRUE)

Arguments

x

Data matrix with positive data only. Observations/features in rows/columns.

target_fnr

Target false positive rate and the nu parameter for the one-svc

sigmas

Vector of inverse kernel widths for the Radial Basis kernel function ordered from low (simple model) to high (complex model) values.

k

Number of cross-validation folds used to estimate the empirical false positive rate.

sigma_thr

consistency threshold in terms of sigma-bounds.

seed

A seed value for the cross-validation split.

selectLastConsistent

If TRUE the model just before passing the consistency threshold is selected. If FALSE the one after the threshold. Defaults to FALSE as this is the default in the dd_toolbox.

oneMoreComplexity

Calculate the false positive rate for one more model after the consistency threshold has been passed. Might be interesting for plotting.

refineGrid

Re-selection with a grid refined between the sigma before and after the selected one? Defaults to FALSE

refineFun

a function that takes a numeric vector of length two, i.e. the new minimum and maximum of the sigma range and creates new values, usually between the two. Defaults to \codefunction(rng) seq(rng[1], rng[2], length.out=10)).

verbose

Print progress info? Defaults to TRUE.

Value

Trained OCSVM model.

References

Tax, D.M.J. & Mueller, K. R., 2004. A consistency-based model selection for one-class classification. In Proceedings of the 17th International Conference on Pattern Recognition, 2004. ICPR 2004. IEEE, pp. 363 to 366 Vol.3. Available at: http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=1334542. Tax, D.M.J., 2015. DDtools, the Data Description Toolbox for Matlab.

Examples

1
2
3
4
5
data(bananas)
idx.p <- sample(which(bananas$y[]==1), 50)
x.p <- bananas$x[][idx.p, ]
mod <- consistent_ocsvm(x.p, sigma_thr=2)
# plot_consistent_ocsvm(mod)

benmack/oneClass documentation built on Dec. 15, 2020, 7:38 p.m.