mahalanobis_distance_cpp: (Generalized) Mahalanobis distance

View source: R/RcppExports.R

mahalanobis_distance_cppR Documentation

(Generalized) Mahalanobis distance

Description

Used to get the Euclidean distance as well by setting mcov = diag(m).

Usage

mahalanobis_distance_cpp(
  featureList,
  Xtrain_mat,
  Xtest_mat,
  mcov,
  S_scale_dist
)

Arguments

featureList

List of vectors indicating all factor combinations that should be included in the computations. Assumes that the first one is empty.

Xtrain_mat

Matrix

Xtest_mat

Matrix

mcov

Matrix. The Sigma-matrix in the Mahalanobis distance formula (stats::cov(Xtrain_mat)) gives Mahalanobis distance, diag(m) gives the Euclidean distance.

S_scale_dist

Logical indicating

Value

Array of three dimensions. Contains the squared distance for between all training and test observations for all feature combinations passed to the function.

Author(s)

Martin Jullum


shapr documentation built on May 4, 2023, 5:10 p.m.