predict.sub_dann {dann}R Documentation

Discriminant Adaptive Nearest Neighbor With Subspace Reduction

Description

Discriminant Adaptive Nearest Neighbor With Subspace Reduction

Usage

## S3 method for class 'sub_dann'
predict(object, new_data, type = "class", ...)

Arguments

object

of class inheriting from "sub_dann"

new_data

A data frame.

type

Type of prediction. (class, prob)

...

unused

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

A data frame containing either class or class probabilities. Adheres to tidy models standards.

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")

test <- mlbench.circle(300, 2) %>%
  tibble::as_tibble()
colnames(test) <- c("X1", "X2", "Y")

model <- sub_dann(Y ~ X1 + X2, train)
predict(model, test, "class")

predict(model, test, "prob")

[Package dann version 1.0.0 Index]