1
我想了解更多關於caret
包的信息,並遇到了我不確定如何解決的包版問題。錯誤:嘗試在使用脫字號包時應用非功能
#loading up libraries
library(MASS)
library(caret)
library(randomForest)
data(survey)
data<-survey
#create training and test set
split <- createDataPartition(data$W.Hnd, p=.8)[[1]]
train<-data[split,]
test<-data[-split,]
#creating training parameters
control <- trainControl(method = "cv",
number = 10,
p =.8,
savePredictions = TRUE,
classProbs = TRUE,
summaryFunction = "twoClassSummary")
#fitting and tuning model
tuningGrid <- data.frame(.mtry = floor(seq(1 , ncol(train) , length = 6)))
rf_tune <- train(W.Hnd ~ . ,
data=train,
method = "rf" ,
metric = "ROC",
trControl = control)
總是收到錯誤:
Error in evalSummaryFunction(y, wts = weights, ctrl = trControl, lev = classLevels, :
attempt to apply non-function
我已經證實,我的DV(W.Hnd)是一個因素水平,使一個隨機森林將是適當的使用進行分類。我的假設是caret
不知道適用於randomForest
算法嗎?除此之外,我不知道。