# source:orange/docs/reference/rst/Orange.regression.lasso.rst@10536:1d480a8785c6

Revision 10536:1d480a8785c6, 2.1 KB checked in by blaz <blaz.zupan@…>, 2 years ago (diff)

Moved documentation from Python module to here.

Line
1############################
2Lasso regression (``lasso``)
3############################
4
5.. automodule:: Orange.regression.lasso
6
7.. index:: regression
8
9.. _`Lasso regression. Regression shrinkage and selection via the lasso`:
10    http://www-stat.stanford.edu/~tibs/lasso/lasso.pdf
11
12
13`The Lasso <http://www-stat.stanford.edu/~tibs/lasso/lasso.pdf>`_ is a shrinkage
14and selection method for linear regression. It minimizes the usual sum of squared
15errors, with a bound on the sum of the absolute values of the coefficients.
16
17To fit the regression parameters on housing data set use the following code:
18
19.. literalinclude:: code/lasso-example.py
20   :lines: 9,10,11
21
22.. autoclass:: LassoRegressionLearner
23    :members:
24
25.. autoclass:: LassoRegression
26    :members:
27
28
29.. autoclass:: LassoRegressionLearner
30    :members:
31
32.. autoclass:: LassoRegression
33    :members:
34
35Utility functions
36-----------------
37
38.. autofunction:: center
39
40.. autofunction:: get_bootstrap_sample
41
42.. autofunction:: permute_responses
43
44
45========
46Examples
47========
48
49To predict values of the response for the first five instances
50use the code
51
52.. literalinclude:: code/lasso-example.py
53   :lines: 14,15
54
55Output
56
57::
58
59    Actual: 24.00, predicted: 24.58
60    Actual: 21.60, predicted: 23.30
61    Actual: 34.70, predicted: 24.98
62    Actual: 33.40, predicted: 24.78
63    Actual: 36.20, predicted: 24.66
64
65To see the fitted regression coefficients, print the model
66
67.. literalinclude:: code/lasso-example.py
68   :lines: 17
69
70The output
71
72::
73
74    Variable  Coeff Est  Std Error          p
75     Intercept     22.533
76          CRIM     -0.000      0.023      0.480
77         INDUS     -0.010      0.023      0.300
78            RM      1.303      0.994      0.000   ***
79           AGE     -0.002      0.000      0.320
80       PTRATIO     -0.191      0.209      0.050     .
81         LSTAT     -0.126      0.105      0.000   ***
82    Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1 empty 1
83
84
85    For 7 variables the regression coefficient equals 0:
86    ZN
87    CHAS
88    NOX
89    DIS