/docs/reference/rst/code/rules-cn2.py
https://bitbucket.org/tadej_janez/orange-distribute · Python · 20 lines · 7 code · 4 blank · 9 comment · 1 complexity · 4700f1f431926d478eef4d078634e443 MD5 · raw file
- # Description: CN2 Rule Induction on Titanic dataset
- # Category: classification
- # Uses: titanic
- # Referenced: Orange.classification.rules
- # Classes: Orange.classification.rules.CN2Learner
- import Orange
- # Read some data
- table = Orange.data.Table("titanic")
- # construct the learning algorithm and use it to induce a classifier
- cn2_learner = Orange.classification.rules.CN2Learner()
- cn2_clasifier = cn2_learner(table)
- # ... or, in a single step.
- cn2_classifier = Orange.classification.rules.CN2Learner(table)
- # All rule-base classifiers can have their rules printed out like this:
- for r in cn2_classifier.rules:
- print Orange.classification.rules.rule_to_string(r)