source: orange/docs/tutorial/rst/code/regression-other.py @ 11692:356c325c0efb

Revision 11692:356c325c0efb, 593 bytes checked in by Ales Erjavec <ales.erjavec@…>, 7 months ago (diff)

Removed 'Earth' code from Orange (moved to 'orangecontrib.earth' package).

Line 
1import Orange
2import random
3
4data = Orange.data.Table("housing")
5test = Orange.data.Table(random.sample(data, 5))
6train = Orange.data.Table([d for d in data if d not in test])
7
8lin = Orange.regression.linear.LinearRegressionLearner(train)
9lin.name = "lin"
10rf = Orange.ensemble.forest.RandomForestLearner(train)
11rf.name = "rf"
12tree = Orange.regression.tree.TreeLearner(train)
13tree.name = "tree"
14
15models = [lin, rf, tree]
16
17print "y    " + " ".join("%-4s" % l.name for l in models)
18for d in test[:3]:
19    print "%.1f" % (d.get_class()),
20    print " ".join("%4.1f" % model(d) for model in models)
Note: See TracBrowser for help on using the repository browser.