The findCorrelation () function of the Caret function

Hello, I am having problems with the findCorrelation () function . Here is my input and output:

findCorrelation(train, cutoff = .50, verbose = FALSE)

Error in findCorrelation_exact (x = x, cutoff = cutoff, verbose = verbose): the correlation matrix is ​​not symmetrical

Does anyone know why this is happening?

+4
source share
2 answers

the findCorrelation function expects the correlation matrix as an x ​​value, so try this instead:

findCorrelation(cor(train), cutoff = .50, verbose = FALSE)

Link: Caret Pretreatment

+8
source

Well, this is because in the matrix it is possible not so much columns as many rows (or vice versa). For example.

library(caret)
train <- cor(mtcars)
findCorrelation(train, cutoff = .50, verbose = FALSE)
# works
findCorrelation(train[, -1], cutoff = .50, verbose = FALSE)
# Error in findCorrelation_exact(x = x, cutoff = cutoff, verbose = verbose) : 
#   correlation matrix is not symmetric
dim(train[, -1])
# [1] 11 10

( , .)

+2

Source: https://habr.com/ru/post/1626602/


All Articles