How to extract the error rate when running a c5.0 decision tree and rule-based model in R?

I tried using the c50 package in R. As explained in this answer , I did the following:

> set.seed(1)

> mod <- train(Species ~ ., data = iris, method = "C5.0")

> summary(mod$finalModel)

      

and the output is

Evaluation on training data (150 cases):

Trial           Rules     
-----     ----------------
  No           Errors

  0         4    4( 2.7%)
  1         5    8( 5.3%)
  2         3    6( 4.0%)
  3         6   12( 8.0%)
  4         4    5( 3.3%)
  5         7    3( 2.0%)
  6         3    8( 5.3%)
  7         8   15(10.0%)
  8         4    3( 2.0%)
  9         5    5( 3.3%)
boost             0( 0.0%)   <<


   (a)   (b)   (c)    <-classified as
  ----  ----  ----
   50                (a): class setosa
         50          (b): class versicolor
               50    (c): class virginica


Attribute usage:


100.00% Petal.Length
66.67% Petal.Width
54.00% Sepal.Width
46.67% Sepal.Length


Time: 0.0 secs

      

My question is, how can we access the error rate (for example 4(2.7%)

) in a way that can be stored in a variable for future analysis? Is there any parameter or attribute that can help me extract the error rate?

+3


source to share


1 answer


You can access it using:

mod$finalModel$boostResults[1,]

      



This will give you the first line:

#  Trial Size Errors Percent         Data
#1     1    4      4     2.7 Training Set

      

+2


source







All Articles