Class GeneralizedIsolationForest

Inheritance Relationships

Base Type

Class Documentation

class genif::GeneralizedIsolationForest : public genif::Learner<std::vector<GIFModel>, VectorX>

Public Functions

GeneralizedIsolationForest(unsigned int k, unsigned int nModels, unsigned int sampleSize, const std::string &kernelId, const VectorX &kernelScaling, data_t sigma, int workerCount = -1, int seed = -1)

Instantiates a GeneralizedIsolationForest.

Parameters
  • k: The number of representatives to find for each node of the tree.

  • nModels: The number of trees to fit.

  • sampleSize: The sample size to consider for every tree to be fit.

  • kernelId: Name of the kernel to use (possible values: rbf, matern-d1, matern-d3, matern-d5).

  • kernelScaling: Vector of scaling values for the kernel to be used (scalar for RBF, d-dimensional vector for Matern kernels - d being the number of dimensions of the input vectors).

  • sigma: Average pairwise kernel values of observations in a data sub-region, which should be exceeded for the exit condition to apply.

  • workerCount: Number of parallel workers to consider (-1 defaults to all available cores).

  • seed: Seed to use for random number generation (-1 defaults to sysclock seed). Pass an integer for constant result across multiple runs.

Learner<std::vector<GIFModel>, VectorX> &fit(const MatrixX &dataset) override

Fits all trees.

Return

A reference to this object.

Parameters
  • dataset: The dataset to use for fitting.

VectorX predict(const MatrixX &dataset) const override

Predicts the outlierness of a dataset by inspecting the learned forest of trees.

Return

A vector, which indicates the probability of inlierness for every input vector.

Parameters
  • dataset: The dataset to inspect.

std::vector<GIFModel> getModel() const override

Returns the learned vector of GIFModels i.e. the trees.

Return

As stated above.

~GeneralizedIsolationForest() override = default

Destructor.