I use a train in a carriage package to train some c50 models. I manage to do a great job with the C5.0 method, but when I want to use the expensive C50 method, I try to understand how to adjust the cost parameter. What I'm trying to do is enter the value when predicting the wrong one of my classes. I tried searching on the carriage package website ( http://topepo.imtqy.com/caret/index.html ) and read some manuals / tutorials found here and there. I did not find any information on how to handle the cost parameter. So here is what I tried myself:
Run the train with the default settings to see what I get. At the output, the train function tried with a cost from 0 to 2 and gave the best model for cost = 2.
Try adding the value in the form of a matrix to the expand.grid function, just like with the C5.0 package. The code is below (tests push to 1, because I just want to have one tree / set of rules in my output)
c50Grid <- expand.grid (.trials = 1, .model = c ("tree", "rules") ,. winnow = c ("TRUE", "FALSE") ,. cost = matrix (c (0,1 , 2.0), ncol = 2))
However, when I perform the function of the train, although I do not receive any errors (but I get 50 warnings), the train again tried to cost from 0 to 2. What am I doing wrong? What format does the cost parameter have? What is the point here? How would I interpret the results? Which class is the one that gets the value like "Predicting class 0 with the wrong value is twice as much as class 1"? In addition, I tried to use one matrix, but although it did not work with this format, how would I add various costs that I want to check?
Thank! Any help would be really appreciated!
Edit:
, C5.0Cost, C5.0Cost.R(https://r-forge.r-project.org/scm/viewvc.php/models/files/C5.0Cost.R?view=markup&root=caret&pathrev=761) .
:
cmat <-matrix(c(0, param$cost, 1, 0), ncol = 2)
, . , , . = {0,1}, - 0, , " 0 , 1", ?
: ? , " 1 , 0", :
cmat <- matrix(c(0, 1, param$cost, 0), ncol=2)
0,5? , 1 {0,5, 0,6, 0,7 ..}.
: , C50 , "Positive class= 0", , C50, , C5.0Cost, ...
.
!