Hi everybody!
I write a KNN model and my script is:
library(class)
library(ggplot2)
library(gmodels)
library(scales)
library(caret)
library(tidyverse)
db_data <- iris
row_train <- sample(nrow(iris), nrow(iris)*0.8)
db_train <- iris[row_train,]
db_test <- iris[-row_train,]
unique(db_train$Species)
table(db_train$Species)
#KNN
#-------
model_knn<-train(Species ~ ., data = db_train, method = "knn",tuneGrid = data.frame(k = c(2:20)))
summary(model_knn)
#-------
#PREDICTION NEW RECORD
#-------
test_data <- db_test
db_test$predict <- predict(model_knn, newdata=test_data, interval='confidence')
confusionMatrix(data=factor(db_test$predict),reference=factor(db_test$Species))
#-------
but when I run the model_knn
I have this error:
Error in train(Species ~ ., data = db_train, method = "knn", tuneGrid = data.frame(k = c(2:20))) :
unused arguments (data = db_train, method = "knn", tuneGrid = data.frame(k = c(2:20)))
I can't understand why, since it was working perfectly until yesterday.
Can anyone tell me why I have this error today? How can I fix it?
Thanks