Revision 10859:08a0a35c1687,
450 bytes
checked in by Lan Zagar <lan.zagar@…>, 2 years ago
(diff) 
Reimplemented lasso. Breaks compatibility.
It now uses a proximal gradient method for optimization instead of using scipy.optimize (see #1118).
The formulation is slightly different so there are new parameters (mainly lasso_lambda instead of t/s).
Improved some other things as well.

Line  

1  # Description: Lasso regression 

2  # Category: regression 

3  

4  import Orange 

5  import numpy 

6  

7  numpy.random.seed(0) 

8  

9  housing = Orange.data.Table("housing") 

10  learner = Orange.regression.lasso.LassoRegressionLearner( 

11  lasso_lambda=1, n_boot=100, n_perm=100) 

12  classifier = learner(housing) 

13  

14  # prediction for five data instances 

15  for ins in housing[:5]: 

16  print "Actual: %3.2f, predicted: %3.2f" % ( 

17  ins.get_class(), classifier(ins)) 

18  

19  print classifier 

Note: See
TracBrowser
for help on using the repository browser.