Caret 패키지의 train 함수는 최종 모델을 반환하며 주 데이터 프레임에서 잘못 분류 된 샘플의 행 인덱스를 찾고 싶습니다.Caret의 train 함수의 최종 모델에서 잘못 분류 된 샘플
library(caret)
train_control <- trainControl(method="cv", number=5,savePredictions = TRUE,classProbs = TRUE)
output <- train(Species~., data=iris, trControl=train_control, method="rf")
다음 최종 모델은 다음과 같습니다 : 나는 다음과 교차 검증을
> output$finalModel
Call:
randomForest(x = x, y = y, mtry = param$mtry)
Type of random forest: classification
Number of trees: 500
No. of variables tried at each split: 4
OOB estimate of error rate: 4.67%
Confusion matrix:
setosa versicolor virginica class.error
setosa 50 0 0 0.00
versicolor 0 47 3 0.06
virginica 0 4 46 0.08
하는 샘플 잘못 분류되어 찾을 수있는 방법이 있나요?