source: orange/docs/tutorial/rst/code/regression-other.py @ 11052:c22077a09e63

Revision 11052:c22077a09e63, 598 bytes checked in by blaz <blaz.zupan@…>, 16 months ago (diff)

new tutorial

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"
10earth = Orange.regression.earth.EarthLearner(train)
11earth.name = "mars"
12tree = Orange.regression.tree.TreeLearner(train)
13tree.name = "tree"
14
15models = [lin, earth, 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.