sub_dann.matrix: Discriminant Adaptive Nearest Neighbor With Subspace...

View source: R/sub_dann.R

sub_dann.matrixR Documentation

Discriminant Adaptive Nearest Neighbor With Subspace Reduction

Description

Discriminant Adaptive Nearest Neighbor With Subspace Reduction

Usage

## S3 method for class 'matrix'
sub_dann(
  x,
  y,
  k = 5,
  neighborhood_size = max(floor(nrow(x)/5), 50),
  epsilon = 1,
  weighted = FALSE,
  sphere = "mcd",
  numDim = ceiling(ncol(x)/2),
  ...
)

Arguments

x

A matrix.

y

A vector.

k

The number of data points used for final classification.

neighborhood_size

The number of data points used to calculate between and within class covariance.

epsilon

Diagonal elements of a diagonal matrix. 1 is the identity matrix.

weighted

weighted argument to ncoord. See fpc::ncoord() for details.

sphere

One of "mcd", "mve", "classical", or "none" See fpc::ncoord() for details.

numDim

Dimension of subspace used by dann. See fpc::ncoord() for details.

...

Additional parameters passed to methods.

Details

An implementation of Hastie and Tibshirani's sub-dann in section 4.1 of Discriminant Adaptive Nearest Neighbor Classification publication..

dann's performance suffers when noise variables are included in the model. Simulations show sub_dann will generally be more performant in this scenario.

Value

An S3 class of type sub_dann

Examples

library(dann)
library(mlbench)
library(magrittr)
library(dplyr)

set.seed(1)
train <- mlbench.circle(300, 2) %>%
  tibble::as_tibble()
colnames(train) <- c("X1", "X2", "Y")
y <- as.numeric(train$Y)
x <- cbind(train$X1, train$X2)

sub_dann(x, y)

dann documentation built on Sept. 23, 2023, 5:06 p.m.