source: orange/docs/reference/rst/code/rules-customized.py @ 9823:7f9c3f3c6474

Revision 9823:7f9c3f3c6474, 1.1 KB checked in by lanumek, 2 years ago (diff)

Changed names of data sets (table replaced with data or name of the data set).

Line 
1# Description: Customized Rule Induction on Titanic dataset
2# Category:    classification
3# Uses:        titanic
4# Referenced:  Orange.classification.rules
5# Classes:     Orange.classification.rules.RuleLearner, Orange.classification.rules.RuleBeamFinder, Orange.classification.rules.RuleValidator_LRS, Orange.classification.rules.RuleBeamFilter_Width
6
7import Orange
8
9learner = Orange.classification.rules.RuleLearner()
10learner.rule_finder = Orange.classification.rules.RuleBeamFinder()
11learner.rule_finder.evaluator = Orange.classification.rules.MEstimateEvaluator(m=50)
12
13titanic =  Orange.data.Table("titanic")
14classifier = learner(titanic)
15
16for r in classifier.rules:
17    print Orange.classification.rules.rule_to_string(r)
18
19learner.rule_finder.rule_stopping_validator = \
20    Orange.classification.rules.RuleValidator_LRS(alpha=0.01,
21                             min_coverage=10, max_rule_complexity = 2)
22learner.rule_finder.rule_filter = \
23    Orange.classification.rules.RuleBeamFilter_Width(width = 50)
24
25classifier = learner(titanic)
26
27for r in classifier.rules:
28    print Orange.classification.rules.rule_to_string(r)
Note: See TracBrowser for help on using the repository browser.