

.. _example_linear_model_plot_lasso_coordinate_descent_path.py:


=====================
Lasso and Elastic Net
=====================

Lasso and elastic net (L1 and L2 penalisation) implemented using a
coordinate descent.

The coefficients can be forced to be positive.



.. rst-class:: horizontal


    *

      .. image:: images/plot_lasso_coordinate_descent_path_1.png
            :scale: 47

    *

      .. image:: images/plot_lasso_coordinate_descent_path_2.png
            :scale: 47

    *

      .. image:: images/plot_lasso_coordinate_descent_path_3.png
            :scale: 47


**Script output**::

  Computing regularization path using the lasso...
  Computing regularization path using the positive lasso...
  Computing regularization path using the elastic net...
  Computing regularization path using the positve elastic net...



**Python source code:** :download:`plot_lasso_coordinate_descent_path.py <plot_lasso_coordinate_descent_path.py>`

.. literalinclude:: plot_lasso_coordinate_descent_path.py
    :lines: 11-
    