source: orange/docs/reference/rst/code/linear-example.py @ 9776:600ac31393ee

Revision 9776:600ac31393ee, 864 bytes checked in by lanumek, 2 years ago (diff)

documentation for regression: lasso, linear, pls

Line 
1# Description: Linear regression
2# Category:    regression
3# Uses:        housing
4# Referenced:  Orange.regression.linear
5# Classes:     Orange.regression.linear.LinearRegressionLearner Orange.regression.linear.LinearRegression
6
7import Orange
8
9housing = Orange.data.Table("housing")
10learner = Orange.regression.linear.LinearRegressionLearner()
11classifier = learner(housing)
12
13# prediction for five data instances and comparison to actual values
14for ins in housing[:5]:
15    print "Actual: %3.2f, predicted: %3.2f " % (ins.get_class(), classifier(ins))
16
17print classifier
18
19# stepwise regression
20learner2 = Orange.regression.linear.LinearRegressionLearner(stepwise=True,
21                                                           add_sig=0.05,
22                                                           remove_sig=0.2)
23classifier = learner2(housing)
24
25print classifier
26
Note: See TracBrowser for help on using the repository browser.