我不明白为什么收到此消息:
火车中的错误(奖牌〜。,数据= training1,方法=“ rf”,ntree = 5): 未使用的参数(数据= training1,方法=“ rf”,ntree = 5)
在我的随机森林算法中。我之前已经运行过一个完全像这样的RF,但是现在却收到此错误。有什么想法吗?
library(caret)
library(randomForest)
OlympicData <- read.csv(file.choose(), header = T)
#convert NAs in Medal column to NoMedal
levels <- levels(OlympicData$Medal)
levels[length(levels) + 1] <- "NoMedal"
OlympicData$Medal <- factor(OlympicData$Medal, levels = levels)
OlympicData$Medal[is.na(OlympicData$Medal)] <- "NoMedal"
summary(OlympicData)
#remove unnecessary columns
OlympicData <- OlympicData[, -1]
OlympicData <- OlympicData[,-1]
OlympicData <- OlympicData[, -7]
OlympicData <- OlympicData[, -6]
summary(OlympicData)
#remove remaining NAs
OlympicData[complete.cases(OlympicData),]
#train model
set.seed(33)
Data_Splitting <- createDataPartition(OlympicData$Medal, p=0.75, list=FALSE)
training1 = OlympicData[Data_Splitting,]
testing1 = OlympicData[-Data_Splitting,]
rf <- train(Medal ~., data = training1, method = "rf", ntree = 5)