C50 Node Assignment
There is a sub-object called 'rules' that has the output of C5.0 for this model:
library(C50) mod <- C5.0(Species ~ ., data = iris, rules = TRUE) cat(mod$rules)
id="See5/C5.0 2.07 GPL Edition 2013-11-09" entries="1" rules="4" default="setosa" conds="1" cover="50" ok="50" lift="2.94231" class="setosa" type="2" att="Petal.Length" cut="1.9" result="<" conds="3" cover="48" ok="47" lift="2.88" class="versicolor" type="2" att="Petal.Length" cut="1.9" result=">" type="2" att="Petal.Length" cut="4.9000001" result="<" type="2" att="Petal.Width" cut="1.7" result="<" conds="1" cover="46" ok="45" lift="2.875" class="virginica" type="2" att="Petal.Width" cut="1.7" result=">" conds="1" cover="46" ok="44" lift="2.8125" class="virginica" type="2" att="Petal.Length" cut="4.9000001" result=">" You would either have to parse this or parse the summary results:
summary(mod)
Call: C5.0.formula(formula = Species ~ ., data = iris, rules = TRUE) <snip> Rules: Rule 1: (50, lift 2.9) Petal.Length <= 1.9 -> class setosa [0.981] Rule 2: (48/1, lift 2.9) Petal.Length > 1.9 Petal.Length <= 4.9 Petal.Width <= 1.7 -> class versicolor [0.960] <snip> Max
On Sat, Nov 9, 2013 at 1:11 PM, Carl Witthoft <carl at witthoft.com> wrote:
Just to clarify: I'm guessing the OP is referring to the CRAN package C50 here. A quick skim suggests the rules are a list element of a C5.0-class object, so maybe that's where to start? David Winsemius wrote
In my role as a moderator I am attempting to bypass the automatic mail filters that are blocking this posting. Please reply to the list and to: ========================= Kevin Shaney <
kevin.shaney@
> C50 Node Assignment I am using C50 to classify individuals into 5 groups / categories (factor variable). The tree / set of rules has 10 rules for classification. I am trying to extract the RULE for which each individual qualifies (a number between 1 and 10), and cannot figure out how to do so. I can extract the predicted group and predicted group probability, but not the RULE to which an individual qualifies. Please let me know if you can help! Kevin ========================= -- David Winsemius Alameda, CA, USA
______________________________________________
R-help@
mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
-- View this message in context: http://r.789695.n4.nabble.com/C50-Node-Assignment-tp4680071p4680127.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Max