0

I am looking for the solution to plot my tree, here you can see my code and the error in the tittle. I try to do clustering by C5.0 package

set.seed(1236)
#Training set (70%)/validation set (30%)
#Sous-groupe emphasis
subset_data <- FacialExpSub[FacialExpSub$Label == "b_emphasis",]
train_indices_emphasis <- createDataPartition(y = subset_data$Label, p = 0.7,
                                     list = FALSE)
emphasis_train_data <- subset_data[train_indices_emphasis, -1]
emphasis_train_data$Label <- "b_emphasis"
emphasis_test_data <- subset_data[-train_indices_emphasis, -1]
emphasis_test_data$Label <- "b_emphasis"

#Sous-groupe relative
subset_data2 <- FacialExpSub[FacialExpSub$Label == "b_relative",]
train_indices2 <- createDataPartition(y = subset_data2$Label, p = 0.7,
                                      list = FALSE)
relative_train_data <- subset_data2[train_indices2, -1]
relative_train_data$Label <- "b_relative"
relative_test_data <- subset_data2[-train_indices2, -1]
relative_test_data$Label <- "b_relative"

#On crée notre base de données de test et d'entraînement
train_data <- rbind(emphasis_train_data, relative_train_data)
test_data <-  rbind(emphasis_test_data, relative_test_data)

#Préprocessing des données : on centre et on met à l'échelle car variables n'ont pas les mêmes unités
procValues <- preProcess(train_data, method = c("center", "scale"))

train_data <- predict(procValues, train_data)
procValues <- preProcess(test_data, method = c("center", "scale"))
test_data <- predict(procValues, test_data)


I

T <-  C5.0(x = train_data[, which(colnames(train_data) != "Label")],
           y = as.factor(train_data$Label))
plot(T)

Thank you for your help !

Phil
  • 7,287
  • 3
  • 36
  • 66
  • please provide enough description of your data (FacialExpSub) or reproducible example dataset to others so they can better understand. – S-SHAAF Feb 11 '23 at 00:10

0 Answers0