Error with decision tree prediction

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?

Your error doesnt reproduce for me, but I get a different error relating to typo tuneLenght / tuneLength

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.