sub_dann.recipe {dann} | R Documentation |
Discriminant Adaptive Nearest Neighbor With Subspace Reduction
Description
Discriminant Adaptive Nearest Neighbor With Subspace Reduction
Usage
## S3 method for class 'recipe'
sub_dann(
x,
data,
k = 5,
neighborhood_size = max(floor(nrow(data)/5), 50),
epsilon = 1,
weighted = FALSE,
sphere = "mcd",
numDim = ceiling(ncol(data)/2),
...
)
Arguments
x |
A recipe from recipes library. |
data |
A data frame. |
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 |
sphere |
One of "mcd", "mve", "classical", or "none" See |
numDim |
Dimension of subspace used by dann. See |
... |
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)
library(recipes)
set.seed(1)
train <- mlbench.circle(300, 2) %>%
tibble::as_tibble()
colnames(train) <- c("X1", "X2", "Y")
rec_obj <- recipe(Y ~ X1 + X2, data = train)
sub_dann(rec_obj, train)