.. _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_001.png
            :scale: 47

    *

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

    *

      .. image:: images/plot_lasso_coordinate_descent_path_003.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-

**Total running time of the example:**  0.24 seconds
( 0 minutes  0.24 seconds)