I write this script in R about decision tree.
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)
model_dt<-train(Species ~ ., data = db_train, method = "rpart",tuneLenght = 9)
summary(model_dt)
#-------
#PREDICTION NEW RECORD
#-------
test_data <- db_test
db_test$predict <- predict(model_dt, newdata=test_data, interval='confidence')
confusionMatrix(data=factor(db_test$predict),reference=factor(db_test$Species))
but when I run model_dt
I have this error:
Error in train(Species ~ ., data = db_train, method = "rpart", tuneLenght = 9) :
unused arguments (data = db_train, method = "rpart", tuneLenght = 9)
why?