View source: R/graph_eigenvalues.R
| graph_eigenvalues.matrix | R Documentation | 
A helper for sub_dann
## S3 method for class 'matrix'
graph_eigenvalues(
  x,
  y,
  neighborhood_size = max(floor(nrow(x)/5), 50),
  weighted = FALSE,
  sphere = "mcd",
  ...
)
x | 
 A matrix.  | 
y | 
 A vector.  | 
neighborhood_size | 
 The number of data points used to calculate between and within class covariance.  | 
weighted | 
 weighted argument to ncoord. See   | 
sphere | 
 One of "mcd", "mve", "classical", or "none" See   | 
... | 
 Additional parameters passed to methods.  | 
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.
A ggplot2 graph.
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 <- as.numeric(train$Y)
x <- cbind(train$X1, train$X2, train$U1, train$U2, train$U3, train$U4, train$U5)
graph_eigenvalues(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.