2016-04-29 4 views
0

Ich lief in einen Fehler "resampled Verwirrung Matrizen sind nicht verfügbar" beim Versuch, Konfusion Matrix aus einem RFE-Objekt zu extrahieren. funktioniert die confusionMaitrx.rfe-Funktion des Caret-Pakets nicht oder fehlt mir hier etwas?Fehler in confusionMatrix.rfe: resampled Verwirrung Matrizen sind nicht verfügbar

Unten ist ein Beispiel von

simulierten Daten mit

http://topepo.github.io/caret/rfe.html

Dokumentation auf Funktion confusionMatrix.rfe ist hier

http://www.inside-r.org/packages/cran/caret/docs/confusionMatrix.train

library(caret) 
library(mlbench) 
library(Hmisc) 
library(randomForest) 
n <- 100 
p <- 40 
sigma <- 1 
set.seed(1) 
sim <- mlbench.friedman1(n, sd = sigma) 
colnames(sim$x) <- c(paste("real", 1:5, sep = ""), 
        paste("bogus", 1:5, sep = "")) 
bogus <- matrix(rnorm(n * p), nrow = n) 
colnames(bogus) <- paste("bogus", 5+(1:ncol(bogus)), sep = "") 
x <- cbind(sim$x, bogus) 
y <- sim$y 
normalization <- preProcess(x) 
x <- predict(normalization, x) 
x <- as.data.frame(x) 
subsets <- c(1:5, 10, 15, 20, 25) 
set.seed(10) 

ctrl <- rfeControl(functions = lmFuncs, 
       method = "repeatedcv", 
       repeats = 5, 
       verbose = FALSE) 

lmProfile <- rfe(x, y, 
      sizes = subsets, 
      rfeControl = ctrl) 

lmProfile 
confusionMatrix(lmProfile) 
**Error in confusionMatrix.rfe(lmProfile) : 
    resampled confusion matrices are not availible** 

Dank!

Antwort

0

mlbench.friedman1 ist ein Regressionsproblem, kein Klassifizierungsproblem. Wenn Sie die Daten überprüfen, können Sie sehen, dass Ihre Y-Variable fortlaufend ist. confusionMatrix hat in diesem Fall keine Verwendung.

+0

Sie haben absolut recht! Vielen Dank. – ybeybe

Verwandte Themen