Changeset 10535:90d6c8e06e82 in orange
 Timestamp:
 03/15/12 17:09:40 (2 years ago)
 Branch:
 default
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Orange/regression/lasso.py
r10314 r10535 1 """\2 ############################3 Lasso regression (``lasso``)4 ############################5 6 .. index:: regression7 8 .. _`Lasso regression. Regression shrinkage and selection via the lasso`:9 http://wwwstat.stanford.edu/~tibs/lasso/lasso.pdf10 11 12 `The Lasso <http://wwwstat.stanford.edu/~tibs/lasso/lasso.pdf>`_ is a shrinkage13 and selection method for linear regression. It minimizes the usual sum of squared14 errors, with a bound on the sum of the absolute values of the coefficients.15 16 To fit the regression parameters on housing data set use the following code:17 18 .. literalinclude:: code/lassoexample.py19 :lines: 7,9,10,1120 21 .. autoclass:: LassoRegressionLearner22 :members:23 24 .. autoclass:: LassoRegression25 :members:26 27 28 .. autoclass:: LassoRegressionLearner29 :members:30 31 .. autoclass:: LassoRegression32 :members:33 34 Utility functions35 36 37 .. autofunction:: center38 39 .. autofunction:: get_bootstrap_sample40 41 .. autofunction:: permute_responses42 43 44 ========45 Examples46 ========47 48 To predict values of the response for the first five instances49 use the code50 51 .. literalinclude:: code/lassoexample.py52 :lines: 14,1553 54 Output55 56 ::57 58 Actual: 24.00, predicted: 24.5859 Actual: 21.60, predicted: 23.3060 Actual: 34.70, predicted: 24.9861 Actual: 33.40, predicted: 24.7862 Actual: 36.20, predicted: 24.6663 64 To see the fitted regression coefficients, print the model65 66 .. literalinclude:: code/lassoexample.py67 :lines: 1768 69 The output70 71 ::72 73 Variable Coeff Est Std Error p74 Intercept 22.53375 CRIM 0.000 0.023 0.48076 INDUS 0.010 0.023 0.30077 RM 1.303 0.994 0.000 ***78 AGE 0.002 0.000 0.32079 PTRATIO 0.191 0.209 0.050 .80 LSTAT 0.126 0.105 0.000 ***81 Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 empty 182 83 84 For 7 variables the regression coefficient equals 0:85 ZN86 CHAS87 NOX88 DIS89 RAD90 TAX91 B92 93 shows that some of the regression coefficients are equal to 0.94 95 96 97 98 99 """100 101 1 import Orange 102 2 import numpy
Note: See TracChangeset
for help on using the changeset viewer.