graph_eigenvalues.data.frame {dann}R Documentation

A helper for sub_dann

Description

A helper for sub_dann

Usage

## S3 method for class 'data.frame'
graph_eigenvalues(
  x,
  y,
  neighborhood_size = max(floor(nrow(x)/5), 50),
  weighted = FALSE,
  sphere = "mcd",
  ...
)

Arguments

x

A data frame.

y

A vector.

neighborhood_size

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

weighted

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

sphere

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

...

Additional parameters passed to methods.

Details

This function plots the eigenvalues found by fpc::ncoord(). The user should make a judgement call on how many eigenvalues are large and set sub_dann's numDim to that number.

Value

A ggplot2 graph.

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

#' # Add 5 unrelated variables
train <- train %>%
  mutate(
    U1 = runif(300, -1, 1),
    U2 = runif(300, -1, 1),
    U3 = runif(300, -1, 1),
    U4 = runif(300, -1, 1),
    U5 = runif(300, -1, 1)
  )

y <- train$Y
x <- cbind(train[, 1:2], train[, 4:8])

graph_eigenvalues(x, y)

[Package dann version 1.0.0 Index]