# doc-cache created by Octave 11.2.0
# name: cache
# type: cell
# rows: 3
# columns: 28
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
IsolationForest


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 610
statistics: Mdl = IsolationForest ( X )
statistics: Mdl = IsolationForest ( X , name , value )

Isolation Forest model for anomaly detection.

An IsolationForest object stores an ensemble of isolation trees fitted
to a set of observations and detects anomalies through the isanomaly
method. Create a model with the iforest function rather than by
calling this constructor directly.

Anomalies are easier to isolate, so they sit closer to the root of a random
isolation tree; the shorter its average path length across the ensemble, the
higher an observation&rsquo;s anomaly score.

See also:
iforest,
isanomaly


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Isolation Forest model for anomaly detection.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
IsolationForest.ContaminationFraction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 116
IsolationForest: property ContaminationFraction

The assumed fraction of anomalies in the training data, in [0, 1] .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
The assumed fraction of anomalies in the training data, in [0, 1].



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
IsolationForest.IsolationForest


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 205
IsolationForest: Mdl = IsolationForest ( X )
IsolationForest: Mdl = IsolationForest ( X , name , value )

Fit an isolation forest to the N -by- P matrix X .
Prefer the iforest function to this constructor.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Fit an isolation forest to the N-by-P matrix X.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
IsolationForest.NumLearners


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 85
IsolationForest: property NumLearners

The number of isolation trees in the ensemble.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
The number of isolation trees in the ensemble.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
IsolationForest.NumObservationsPerLearner


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 119
IsolationForest: property NumObservationsPerLearner

The number of observations subsampled to grow each isolation tree.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
The number of observations subsampled to grow each isolation tree.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
IsolationForest.ScoreThreshold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 104
IsolationForest: property ScoreThreshold

The score above which an observation is flagged as an anomaly.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
The score above which an observation is flagged as an anomaly.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
IsolationForest.isanomaly


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 505
IsolationForest: tf = isanomaly ( Mdl , Xnew )
IsolationForest: [ tf , scores ] = isanomaly ( Mdl , Xnew )
IsolationForest: [&hellip;] = isanomaly (&hellip;, 'ScoreThreshold' , t )

Detect anomalies in the new observations Xnew using the fitted
model Mdl . Returns the logical vector tf flagging anomalies
and the anomaly scores , each obtained by dropping Xnew
through the isolation trees. The threshold defaults to
Mdl .ScoreThreshold and may be overridden with the
'ScoreThreshold' name-value argument.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Detect anomalies in the new observations Xnew using the fitted model Mdl.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
LocalOutlierFactor


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 683
statistics: Mdl = LocalOutlierFactor ( X )
statistics: Mdl = LocalOutlierFactor ( X , name , value )

Local Outlier Factor model for anomaly detection.

A LocalOutlierFactor object stores a Local Outlier Factor (LOF) model
fitted to a set of observations, and detects anomalies among those or new
observations through the isanomaly method. Create a model with the
lof function rather than by calling this constructor directly.

The LOF of an observation compares its local density with the local density
of its neighbors; a value near 1 indicates an inlier, whereas a value well
above 1 indicates an outlier that lies in a sparser region than its
neighbors.

See also:
lof,
isanomaly


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Local Outlier Factor model for anomaly detection.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
LocalOutlierFactor.ContaminationFraction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 119
LocalOutlierFactor: property ContaminationFraction

The assumed fraction of anomalies in the training data, in [0, 1] .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
The assumed fraction of anomalies in the training data, in [0, 1].



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
LocalOutlierFactor.Distance


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 105
LocalOutlierFactor: property Distance

The distance metric used to find neighbors, as a character vector.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
The distance metric used to find neighbors, as a character vector.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
LocalOutlierFactor.LocalOutlierFactor


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 222
LocalOutlierFactor: Mdl = LocalOutlierFactor ( X )
LocalOutlierFactor: Mdl = LocalOutlierFactor ( X , name , value )

Fit a Local Outlier Factor model to the N -by- P matrix
X . Prefer the lof function to this constructor.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Fit a Local Outlier Factor model to the N-by-P matrix X.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
LocalOutlierFactor.NumNeighbors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 116
LocalOutlierFactor: property NumNeighbors

The number of nearest neighbors used to compute the Local Outlier Factor.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
The number of nearest neighbors used to compute the Local Outlier Factor.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
LocalOutlierFactor.ScoreThreshold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 107
LocalOutlierFactor: property ScoreThreshold

The score above which an observation is flagged as an anomaly.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
The score above which an observation is flagged as an anomaly.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
LocalOutlierFactor.isanomaly


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 538
LocalOutlierFactor: tf = isanomaly ( Mdl , Xnew )
LocalOutlierFactor: [ tf , scores ] = isanomaly ( Mdl , Xnew )
LocalOutlierFactor: [&hellip;] = isanomaly (&hellip;, 'ScoreThreshold' , t )

Detect anomalies in the new observations Xnew using the fitted
model Mdl . Returns the logical vector tf flagging anomalies
and the Local Outlier Factor scores , each computed from the nearest
neighbors of Xnew in the training data. The threshold defaults to
Mdl .ScoreThreshold and may be overridden with the
'ScoreThreshold' name-value argument.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Detect anomalies in the new observations Xnew using the fitted model Mdl.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
OneClassSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 665
statistics: Mdl = OneClassSVM ( X )
statistics: Mdl = OneClassSVM ( X , name , value )

One-class support vector machine model for anomaly detection.

A OneClassSVM object stores a one-class support vector machine fitted
to a set of observations in an expanded feature space, and detects anomalies
through the isanomaly method. Create a model with the ocsvm
function rather than by calling this constructor directly.

The model maps the data to a randomized feature space that approximates a
Gaussian kernel and fits a linear boundary that encloses the bulk of the
observations; points outside the boundary receive higher anomaly scores.

See also:
ocsvm,
isanomaly


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
One-class support vector machine model for anomaly detection.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
OneClassSVM.ContaminationFraction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 112
OneClassSVM: property ContaminationFraction

The assumed fraction of anomalies in the training data, in [0, 1] .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
The assumed fraction of anomalies in the training data, in [0, 1].



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
OneClassSVM.KernelScale


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 106
OneClassSVM: property KernelScale

The scale of the Gaussian kernel approximated by the feature expansion.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 71
The scale of the Gaussian kernel approximated by the feature expansion.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
OneClassSVM.Lambda


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 81
OneClassSVM: property Lambda

The strength of the ridge (L2) regularization term.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
The strength of the ridge (L2) regularization term.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
OneClassSVM.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 81
OneClassSVM: property Mu

The predictor means used for standardization, or empty.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
The predictor means used for standardization, or empty.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
OneClassSVM.NumExpansionDimensions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 101
OneClassSVM: property NumExpansionDimensions

The number of dimensions of the expanded feature space.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
The number of dimensions of the expanded feature space.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
OneClassSVM.OneClassSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
OneClassSVM: Mdl = OneClassSVM ( X )
OneClassSVM: Mdl = OneClassSVM ( X , name , value )

Fit a one-class support vector machine to the N -by- P matrix
X . Prefer the ocsvm function to this constructor.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Fit a one-class support vector machine to the N-by-P matrix X.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
OneClassSVM.ScoreThreshold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 100
OneClassSVM: property ScoreThreshold

The score above which an observation is flagged as an anomaly.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
The score above which an observation is flagged as an anomaly.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
OneClassSVM.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 98
OneClassSVM: property Sigma

The predictor standard deviations used for standardization, or empty.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
The predictor standard deviations used for standardization, or empty.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
OneClassSVM.isanomaly


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 433
OneClassSVM: tf = isanomaly ( Mdl , Xnew )
OneClassSVM: [ tf , scores ] = isanomaly ( Mdl , Xnew )
OneClassSVM: [&hellip;] = isanomaly (&hellip;, 'ScoreThreshold' , t )

Detect anomalies in the new observations Xnew using the fitted
model Mdl . Returns the logical vector tf flagging anomalies
and the anomaly scores . The threshold defaults to
Mdl .ScoreThreshold and may be overridden with the
'ScoreThreshold' name-value argument.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Detect anomalies in the new observations Xnew using the fitted model Mdl.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
iforest


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1972
statistics: Mdl = iforest ( X )
statistics: [ Mdl , tf ] = iforest ( X )
statistics: [ Mdl , tf , scores ] = iforest ( X )
statistics: [&hellip;] = iforest (&hellip;, name , value )

Detect anomalies with an isolation forest.

Mdl = iforest ( X ) fits an isolation forest to the
N -by- P matrix X , whose rows are observations and columns
are variables, and returns an IsolationForest object Mdl .

[ Mdl , tf , scores ] = iforest ( X ) also returns
the N -by-1 logical vector tf flagging the anomalous observations
and the N -by-1 vector scores of anomaly scores in the range
[0, 1] . A higher score indicates an observation that is more easily
isolated, and therefore more likely to be an anomaly.

The score of an observation is 2^(-E[h] / c) , where E[h] is its
average path length over the isolation trees and c is the expected
path length of an unsuccessful search in a binary tree of
NumObservationsPerLearner nodes. Each tree is grown from a random
subsample of the data by recursively splitting on a random variable at a
random value, so anomalies, being easier to isolate, obtain shorter paths.

Additional parameters can be specified by Name-Value pair arguments.

Name Value
'NumLearners' the number of isolation trees, a positive
integer (default 100).
'NumObservationsPerLearner' the subsample size used to
grow each tree, an integer in [3, N] (default min ( N ,
256) ).
'ContaminationFraction' the assumed fraction of anomalies
in X , a scalar in [0, 1] (default 0). It sets
Mdl .ScoreThreshold to quantile ( scores , 1 -
ContaminationFraction ) ; when it is 0 the threshold is the maximum
score and no training observation is flagged.

Because the trees are grown from random subsamples and random splits, the
scores depend on the state of the random number generator and are not
reproducible across runs unless the generator is seeded.

Use the isanomaly method of Mdl to detect anomalies in new data.

See also:
IsolationForest,
isanomaly,
lof,
robustcov


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Detect anomalies with an isolation forest.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
lof


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1971
statistics: Mdl = lof ( X )
statistics: [ Mdl , tf ] = lof ( X )
statistics: [ Mdl , tf , scores ] = lof ( X )
statistics: [&hellip;] = lof (&hellip;, name , value )

Detect anomalies with the Local Outlier Factor (LOF) method.

Mdl = lof ( X ) fits a Local Outlier Factor model to the
N -by- P matrix X , whose rows are observations and columns
are variables, and returns a LocalOutlierFactor object Mdl .

[ Mdl , tf , scores ] = lof ( X ) also returns the
N -by-1 logical vector tf flagging the anomalous observations and
the N -by-1 vector scores of LOF values. A score near 1
indicates an inlier, whereas a score well above 1 indicates an outlier lying
in a region sparser than its neighbors.

The Local Outlier Factor of an observation is the average ratio of the local
reachability density of its NumNeighbors nearest neighbors to its own
local reachability density, where the local reachability density is the
inverse mean reachability distance to those neighbors and the reachability
distance from p to o is max (k-distance (o), d (p, o)) .

Additional parameters can be specified by Name-Value pair arguments.

Name Value
'NumNeighbors' the number of nearest neighbors, a positive
integer less than N . The default is min (20, u - 1) ,
where u is the number of unique observations.
'Distance' the distance metric used to find neighbors, one
of the metrics accepted by pdist2 ( 'euclidean' by default).
'ContaminationFraction' the assumed fraction of anomalies
in X , a scalar in [0, 1] (default 0). It sets
Mdl .ScoreThreshold to quantile ( scores , 1 -
ContaminationFraction ) ; when it is 0 the threshold is the maximum
score and no training observation is flagged.
'Exponent' the Minkowski distance exponent (default 2),
used only with the 'minkowski' distance.
'Cov' the covariance matrix used only with the
'mahalanobis' distance.

Use the isanomaly method of Mdl to detect anomalies in new data.

See also:
LocalOutlierFactor,
isanomaly,
dbscan,
robustcov


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Detect anomalies with the Local Outlier Factor (LOF) method.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
ocsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2589
statistics: Mdl = ocsvm ( X )
statistics: [ Mdl , tf ] = ocsvm ( X )
statistics: [ Mdl , tf , scores ] = ocsvm ( X )
statistics: [&hellip;] = ocsvm (&hellip;, name , value )

Detect anomalies with a one-class support vector machine.

Mdl = ocsvm ( X ) fits a one-class support vector machine to
the N -by- P matrix X , whose rows are observations and
columns are variables, and returns a OneClassSVM object Mdl .

[ Mdl , tf , scores ] = ocsvm ( X ) also returns the
N -by-1 logical vector tf flagging the anomalous observations and
the N -by-1 vector scores of anomaly scores. A higher score
indicates an observation that lies further outside the boundary enclosing the
data, and is therefore more likely to be an anomaly.

The observations are mapped to a randomized feature space that approximates a
Gaussian kernel of scale KernelScale using NumExpansionDimensions
features, and a linear one-class boundary is fitted there with ridge
regularization of strength Lambda .

Additional parameters can be specified by Name-Value pair arguments.

Name Value
'KernelScale' the scale of the approximated Gaussian
kernel, a positive scalar or 'auto' (default).
'Lambda' the ridge regularization strength, a nonnegative
scalar or 'auto' (default).
'NumExpansionDimensions' the number of expanded feature
dimensions, a positive integer or 'auto' (default).
'StandardizeData' a logical scalar (default
false ); when true each predictor is centered and scaled and the
means and standard deviations are stored in Mdl .Mu and
Mdl .Sigma .
'ContaminationFraction' the assumed fraction of anomalies
in X , a scalar in [0, 1] (default 0). It sets
Mdl .ScoreThreshold to quantile ( scores , 1 -
ContaminationFraction ) ; when it is 0 the threshold is the maximum
score and no training observation is flagged.

The feature expansion uses random projections, so the scores depend on the
state of the random number generator and are not reproducible across runs
unless the generator is seeded. The 'auto' selections and the fitted
model differ from MATLAB&rsquo;s implementation, which uses a different feature
expansion and solver.

For a deterministic, classic one-class support vector machine (a
nu-SVM with an exact kernel, computed through libsvm ), use
fitcsvm with a single class in the response or with the 'Nu'
name-value argument; that path returns a ClassificationSVM object
whose predict method labels observations, rather than the
anomaly-scoring interface provided here.

Use the isanomaly method of Mdl to detect anomalies in new data.

See also:
OneClassSVM,
isanomaly,
iforest,
lof,
fitcsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Detect anomalies with a one-class support vector machine.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
robustcov


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2411
statistics: sig = robustcov ( X )
statistics: [ sig , mu ] = robustcov ( X )
statistics: [ sig , mu , mah ] = robustcov ( X )
statistics: [ sig , mu , mah , outliers ] = robustcov ( X )
statistics: [ sig , mu , mah , outliers , s ] = robustcov ( X )
statistics: [&hellip;] = robustcov (&hellip;, name , value )

Robust multivariate covariance and mean estimate.

sig = robustcov ( X ) returns a robust estimate sig of
the covariance matrix of the N&times;P data matrix X , computed so that
it is not distorted by outlying observations. Rows of X are
observations and columns are variables. Rows containing NaN values
are removed.

[ sig , mu , mah , outliers , s ] = robustcov
(&hellip;) also returns the robust mean mu ( 1&times;P ), the robust
Mahalanobis distances mah ( N&times;1 ) of each observation from the
estimated distribution, a logical vector outliers ( N&times;1 ) flagging
observations whose distance exceeds sqrt (chi2inv (0.975, P )) ,
and a structure s holding the estimate metadata.

Additional parameters can be specified by Name-Value pair arguments.

Name Value
'Method' the estimator, either 'fmcd' (default,
the Fast Minimum Covariance Determinant algorithm) or 'ogk' (the
Orthogonalized Gnanadesikan-Kettenring estimator). 'olivehawkins' is
not implemented.
'OutlierFraction' the maximum fraction of outliers, a
scalar in [0, 0.5] (default 0.5), used to set the size of the
elemental subsets in 'fmcd' .
'NumTrials' the number of random elemental subsets drawn
by 'fmcd' , a positive integer (default 500).
'BiasCorrection' a logical scalar (default true )
that applies the small-sample bias correction to the 'fmcd' estimate.
'NumOGKIterations' the number of orthogonalization
iterations for 'ogk' , a positive integer (default 2).
'UnivariateEstimator' the robust univariate
location/scale estimator used by 'ogk' , either 'tauscale'
(default) or 'qn' .

Note on reproducibility. 'fmcd' draws random subsets, so its
exact estimate depends on the random number generator and is not identical to
MATLAB&rsquo;s on data where the optimal subset is ambiguous; on well-separated
data both converge to the same estimate. For 'fmcd' with
'BiasCorrection' enabled, the small-sample factor uses the published
Pison-Van Aelst-Willems asymptotic formula, which differs from MATLAB&rsquo;s
tabulated simulation values by up to about 1.6% for very small samples.

See also:
mahal,
cov,
mad,
dbscan


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Robust multivariate covariance and mean estimate.





