fk_mdh: Minimum density hyperplanes

View source: R/fk_mdh.R

fk_mdhR Documentation

Minimum density hyperplanes


Estimates minimum density hyperplanes for clustering using projection pursuit, based on the method of Pavlidis et al. (2016)


fk_mdh(X, v0 = NULL, hmult = 1, beta = c(.25,.25), alphamax = 1)



numeric data matrix (num_data x num_dimensions).


(optional) vector representing the initial projection direction. Default is the first principal direction.


(optional) positive numeric. The bandwidth in the kernel density is set to hmult multiplied by Silverman's rule of thumb value, which is based on the AMISE minimiser when the underlying distribution is Gaussian.


(optional) numeric vector of kernel coefficients. The default is the smooth order one kernel described by Hofmeyr (2019).


(optional) maximum/final (scaled) distance of the optimal hyperplane from the mean of the data. The default is alphamax = 1.


A named list with fields


the optimal projection vector.


the location of the minimum density hyperplane orthogonal to v.


Pavlidis N.G., Hofmeyr D.P., Tasoulis S.K. (2016) "Minimum Density Hyperplanes", Journal of Machine Learning Research, 17(156), 1–33.

Hofmeyr, D.P. (2021) "Fast exact evaluation of univariate kernel sums", IEEE Transactions on Pattern Analysis and Machine Intelligence, 43(2), 447-458.


op <- par(no.readonly = TRUE)


### Generate data from a simple 10 component mixture model in 10 dimensions:
### Determine means of components

mu <- matrix(runif(100), ncol = 10)

### Determine scales of components (diagonal elements of covariance)

covs <- matrix(rexp(100), ncol = 10)/10

### Determine cluster indicator matrix

I <- t(rmultinom(2000, 1, 1:10))

### Determine mean and residual matrix

M <- I%*%mu

R <- matrix(rnorm(20000), 2000, 10)*(I%*%covs)

### Data is given by the sum of these

X <- M + R

### Find the minimum density hyperplane separator and plot
### the projected data as well as the PCA plot for comparison

mdh <- fk_mdh(X)

par(mfrow = c(2, 2))

plot(X%*%mdh$v, X%*%eigen(cov(X))$vectors[,2], xlab = 'mdh vector',
    ylab = '2nd principal component', main = 'MDH solution')
abline(v = mdh$b, col = 2)
plot(X%*%eigen(cov(X))$vectors[,1:2], xlab = '1st principal component',
    ylab = '2nd principal component', main = 'PCA plot')

abline(v = mdh$b, col = 2)


FKSUM documentation built on April 15, 2023, 5:06 p.m.