predict.dann {dann}R Documentation

Discriminant Adaptive Nearest Neighbor Classification

Description

Discriminant Adaptive Nearest Neighbor Classification

Usage

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

Arguments

object

of class inheriting from "dann"

new_data

A data frame.

type

Type of prediction. (class, prob)

...

unused

Details

This is an implementation of Hastie and Tibshirani's Discriminant Adaptive Nearest Neighbor Classification publication..

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 <- dann(Y ~ X1 + X2, train)
predict(model, test, "class")

predict(model, test, "prob")

[Package dann version 1.0.0 Index]