{"id":112097,"date":"2026-06-03T21:54:28","date_gmt":"2026-06-03T16:24:28","guid":{"rendered":"https:\/\/www.guvi.in\/blog\/?p=112097"},"modified":"2026-06-03T21:54:30","modified_gmt":"2026-06-03T16:24:30","slug":"what-is-lasso-regression","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/what-is-lasso-regression\/","title":{"rendered":"What is Lasso Regression? An Introduction to L1 Regularisation"},"content":{"rendered":"\n<p>Machine learning models tend to overfit the training data and cannot generalise well to unseen data. This is known as overfitting. To solve this, machine learning engineers use regularisation techniques that control model complexity and improve generalisation.<\/p>\n\n\n\n<p>Lasso Regression is among the most common regularisation techniques in machine learning. This reduces overfitting and also does automatic feature selection, making models simpler and more efficient.<\/p>\n\n\n\n<p>In this article, you will learn what Lasso Regression is, how L1 regularisation works, why feature selection matters, how the lambda parameter affects the model performance and how to implement Lasso Regression using Scikit Learn.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>TLDR;<\/strong><\/h2>\n\n\n\n<ol>\n<li>Lasso Regression is a regularised regression technique, which uses L1 regularisation to reduce overfitting.<\/li>\n\n\n\n<li>It shrinks less important feature coefficients towards zero.<\/li>\n\n\n\n<li>Some coefficients are precisely zero, which helps in automatic feature selection.<\/li>\n\n\n\n<li>The lambda parameter regulates the shrinkage level of the model.<\/li>\n\n\n\n<li>Lasso regression is commonly used when data sets contain many irrelevant features.<\/li>\n\n\n\n<li>Sklearn Lasso has a simple implementation in Scikit Learn.<\/li>\n<\/ol>\n\n\n\n<div class=\"guvi-answer-card\" style=\"margin: 40px 0;\">\n\n  <div style=\"\n    position: relative;\n    background: linear-gradient(135deg, #f0fff4, #e6f7ee);\n    border: 1px solid #cfeedd;\n    padding: 26px 24px 22px 24px;\n    border-radius: 14px;\n    font-family: Arial, sans-serif;\n    box-shadow: 0 6px 16px rgba(0,0,0,0.05);\n  \">\n\n    <!-- Top accent -->\n    <div style=\"\n      position: absolute;\n      top: 0;\n      left: 0;\n      height: 6px;\n      width: 100%;\n      background: linear-gradient(to right, #099f4e, #6dd5a3);\n      border-radius: 14px 14px 0 0;\n    \"><\/div>\n\n    <!-- Title -->\n    <h3 style=\"\n      margin: 10px 0 12px 0;\n      color: #099f4e;\n      font-size: 20px;\n    \">\n      What is Lasso Regression?\n    <\/h3>\n\n    <!-- Content -->\n    <p style=\"\n      margin: 0;\n      color: #2f4f3f;\n      font-size: 16px;\n      line-height: 1.7;\n    \">\n      Lasso Regression is a type of linear regression that adds a penalty term to the loss function to reduce model complexity and prevent overfitting. LASSO stands for Least Absolute Shrinkage and Selection Operator, and it works by penalizing the absolute values of regression coefficients. As the penalty increases, the model shrinks coefficient values, and some coefficients may become exactly zero. This property makes Lasso Regression especially useful for feature selection, as it can automatically remove less important features from the model.\n    <\/p>\n\n  <\/div>\n\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Importance of Regularisation<\/strong><\/h2>\n\n\n\n<p>Machine learning models can sometimes memorise training data rather than learn real patterns. This leads to high variance and poor real-world performance.<\/p>\n\n\n\n<p>Regularisation is a way to control this problem by adding penalties to large coefficients.<\/p>\n\n\n\n<p>The main advantages of regularisation are as follows:<\/p>\n\n\n\n<ol>\n<li>Overfitting mitigation<\/li>\n\n\n\n<li>Improving model generalisability.<\/li>\n\n\n\n<li>Stabilising the model.<\/li>\n\n\n\n<li>Better interpretability.<\/li>\n<\/ol>\n\n\n\n<p>Lasso Regression does this with L1 regularisation.<\/p>\n\n\n\n<p>Lasso Regression does this with L1 regularisation. If you want to understand regularisation concepts in more detail, you can also read this guide on<a href=\"https:\/\/www.guvi.in\/blog\/guide-to-regularization-in-machine-learning\/\" target=\"_blank\" rel=\"noreferrer noopener\"> Regularisation in Machine Learning<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>L1 Regularisation Explained<\/strong><\/h2>\n\n\n\n<p>L1 regularisation adds the sum of the absolute values of coefficients to the loss function.<\/p>\n\n\n\n<p>The mathematical objective function of Lasso Regression is as follows:<\/p>\n\n\n\n<p>Loss = RSS + \u03bb \u2211 |\u03b2|<\/p>\n\n\n\n<p>Where:<\/p>\n\n\n\n<ol>\n<li>RSS = Residual Sum of Squares.<\/li>\n\n\n\n<li>\u03bb the lambda parameter.<\/li>\n\n\n\n<li>The coefficients of the model are \u03b2.<\/li>\n<\/ol>\n\n\n\n<p>The amount of the penalty is controlled by the parameter lambda.<\/p>\n\n\n\n<p>The coefficients shrink more aggressively as lambda increases.<\/p>\n\n\n\n<p>Another unique property of L1 regularisation is that it can zero out coefficients. Some of the feature weights become exactly zero, removing those variables from the model.<\/p>\n\n\n\n<p>This leads to a sparse model.<\/p>\n\n\n\n<p>Curious about how these concepts work? Download <strong>HCL GUVI\u2019s<\/strong> free <a href=\"https:\/\/www.guvi.in\/mlp\/genai-ebook?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=What+is+Lasso+Regression%3F+An+Introduction+to+L1+Regularisation\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>AI ebook<\/strong><\/a> to learn more about machine learning concepts, regression models, and real-world AI applications.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Sparse Model is defined as:<\/strong><\/h2>\n\n\n\n<p>In a sparse model, many of the feature coefficients are zero.<\/p>\n\n\n\n<p>That is, the model only keeps the variables that are relevant and discards the irrelevant ones.<\/p>\n\n\n\n<p>Sparse models are useful because they:<\/p>\n\n\n\n<ol>\n<li>Reduce the model complexity.<\/li>\n\n\n\n<li>Make it more interpretable.<\/li>\n\n\n\n<li>Lower cost of computing.<\/li>\n\n\n\n<li>Helps to avoid noisy features.<\/li>\n\n\n\n<li>Make predictions more efficient.<\/li>\n<\/ol>\n\n\n\n<p>This is one of the biggest advantages of Lasso Regression over linear regression.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How Lasso Regression Does Feature Selection<\/strong><\/h2>\n\n\n\n<p>Feature selection is the identification of the most important variables in a dataset.<\/p>\n\n\n\n<p>Traditional linear regression uses all features, even though some features have very little contribution.<\/p>\n\n\n\n<p>It automatically drops the weak features by setting their coefficients to 0.<\/p>\n\n\n\n<p>For example, a model to predict the price of a house might have features such as:<\/p>\n\n\n\n<ol>\n<li>Territory.<\/li>\n\n\n\n<li>Rooms.<\/li>\n\n\n\n<li>Property age.<\/li>\n\n\n\n<li>Wall Colour.<\/li>\n\n\n\n<li>Nickname of the owner.<\/li>\n<\/ol>\n\n\n\n<p>Some features, like wall colour or owner nickname, might not be very predictive.<\/p>\n\n\n\n<p>Lasso Regression can set its coefficients to zero and remove them from the model.<\/p>\n\n\n\n<p>Traditional linear regression uses all features, even though some features have very little contribution. To understand how regression models work before regularisation, you can also explore this<a href=\"https:\/\/www.guvi.in\/blog\/linear-regression-model-in-machine-learning-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\"> Linear Regression Model in the Machine Learning Guide<\/a>.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Meaning of the lambda parameter<\/strong><\/h2>\n\n\n\n<p>One of the most important parts of Lasso Regression is the lambda parameter.<\/p>\n\n\n\n<p>It controls the degree of regularisation applied.<\/p>\n\n\n\n<p>Different values of lambda give different results:<\/p>\n\n\n\n<ol>\n<li>Lambda = 0 is like normal linear regression.<\/li>\n\n\n\n<li>Small \u03bb results in mild shrinkage.<\/li>\n\n\n\n<li>Large lambda shrinks coefficients aggressively. The model may be underfitting with a large lambda.<\/li>\n<\/ol>\n\n\n\n<p>Choosing the right lambda is crucial to balancing bias and variance.<\/p>\n\n\n\n<p>This is called the bias-variance tradeoff.<\/p>\n\n\n\n<p>If the bias is low, the model may overfit.<\/p>\n\n\n\n<p>A very high bias model could underfit.<\/p>\n\n\n\n<p>Lasso Regression helps to find a happy medium.<\/p>\n\n\n\n<p>Choosing the right lambda is crucial to balancing bias and variance. This concept is closely related to the<a href=\"https:\/\/www.guvi.in\/blog\/bias-and-variance-in-machine-learning\/\" target=\"_blank\" rel=\"noreferrer noopener\"> Bias and Variance in Machine Learning Guide<\/a>.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Ridge Regression vs Lasso Regression<\/strong><\/h2>\n\n\n\n<p>Lasso and Ridge Regression are both regularised regression techniques, but they behave differently.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Lasso Regression:<\/strong><\/h3>\n\n\n\n<ol>\n<li>Uses L1 norm regularisation.<\/li>\n\n\n\n<li>Coefficients can be forced to be exactly zero.<\/li>\n\n\n\n<li>Feature selection.<\/li>\n\n\n\n<li>Creates sparse models.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Ridge regression (RR)<\/strong><\/h3>\n\n\n\n<ol>\n<li>L2 regularisation is applied.<\/li>\n\n\n\n<li>It reduces coefficients but rarely to zero.<\/li>\n\n\n\n<li>Keeps all properties of the model.<\/li>\n\n\n\n<li>Works fine when all variables are a little.<\/li>\n<\/ol>\n\n\n\n<p>If you have a lot of irrelevant features in your dataset, then Lasso Regression is often a better choice.<\/p>\n\n\n\n<p>Lasso and Ridge Regression are both regularised regression techniques, but they behave differently. You can also explore other important regression models in this<a href=\"https:\/\/www.guvi.in\/blog\/types-of-regression-in-machine-learning\/\" target=\"_blank\" rel=\"noreferrer noopener\"> Types of Regression in Machine Learning Guide<\/a>.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is Elastic Net?<\/strong><\/h2>\n\n\n\n<p>Elastic Net is a hybrid of L1 and L2 regularisation.<\/p>\n\n\n\n<p>It inherits the best of both Lasso and Ridge Regression.<\/p>\n\n\n\n<p>Elastic Net is helpful when:<\/p>\n\n\n\n<ol>\n<li>Features are highly correlated.<\/li>\n\n\n\n<li>There are many variables in the data set.<\/li>\n\n\n\n<li>Lasso can become less stable.<\/li>\n\n\n\n<li>We want a better trade-off between shrinkage and feature selection.<\/li>\n<\/ol>\n\n\n\n<p>Many production machine learning systems use Elastic Net for better stability.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Implement Lasso Regression in Scikit-Learn<\/strong><\/h2>\n\n\n\n<p>Lasso Regression is simply implemented in Scikit-Learn.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Install Required Libraries<\/strong><\/h3>\n\n\n\n<p>pip install pandas numpy scikit-learn<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Import Libraries<\/strong><\/h3>\n\n\n\n<p>from sklearn.linear_model import Lasso<\/p>\n\n\n\n<p>from sklearn.model_selection import train_test_split<\/p>\n\n\n\n<p>from sklearn.metrics import mean_squared_error<\/p>\n\n\n\n<p>from sklearn.datasets import load_diabetes<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Load Dataset<\/strong><\/h3>\n\n\n\n<p>data = load_diabetes()<\/p>\n\n\n\n<p>X = data.y = data.target<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Split the data into training data and testing data<\/strong><\/h3>\n\n\n\n<p>X_train, X_test, y_train, y_test = train_test_split(<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;X, y, test_size=0.2, random_state=42<\/p>\n\n\n\n<p>)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Build and Train the Model<\/strong><\/h3>\n\n\n\n<p>model = Lasso(alpha=0.1)<\/p>\n\n\n\n<p>model.fit(X_train, y_train)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 6: Make predictions<\/strong><\/h3>\n\n\n\n<p>predictions = model.predict(X_test)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 7: Evaluate the Model<\/strong><\/h3>\n\n\n\n<p>mse = mean_squared_error(y_test, predictions)<\/p>\n\n\n\n<p>print(&#8220;Mean Squared Error:&#8221;, mse)<\/p>\n\n\n\n<p>The alpha parameter in Scikit Learn is the same as the lambda parameter.<\/p>\n\n\n\n<p>The larger the alpha is, the stronger the regularisation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Benefits of Lasso Regression<\/strong><\/h2>\n\n\n\n<p>Lasso Regression has several advantages in machine learning.<\/p>\n\n\n\n<ol>\n<li>Reduces overfitting nicely.<\/li>\n\n\n\n<li>Features are selected automatically.<\/li>\n\n\n\n<li>Leads to simpler and more interpretable models.<\/li>\n\n\n\n<li>Reduces noise from less important features.<\/li>\n\n\n\n<li>It works well for high-dimensional data sets.<\/li>\n\n\n\n<li>Helps increase computational efficiency.<\/li>\n<\/ol>\n\n\n\n<p>These benefits make Lasso Regression a very useful technique for practical machine learning applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Drawbacks of Lasso Regression<\/strong><\/h2>\n\n\n\n<p>However, Lasso Regression also has its shortcomings.<\/p>\n\n\n\n<ol>\n<li>May remove useful correlated variables.<\/li>\n\n\n\n<li>Performance may be unstable for highly correlated features.<\/li>\n\n\n\n<li>The lambda value is selected through tuning.<\/li>\n\n\n\n<li>Underfitting is possible at high regularisation.<\/li>\n<\/ol>\n\n\n\n<p>In these cases, Elastic Net may sometimes perform better.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Lasso Regression in Practical Scenarios<\/strong><\/h2>\n\n\n\n<p>Lasso Regression has many applications in many industries.<\/p>\n\n\n\n<p>Some common uses are:<\/p>\n\n\n\n<ol>\n<li>Medical diagnostic systems.<\/li>\n\n\n\n<li>Financial risk forecasting.<\/li>\n\n\n\n<li>Customer Attrition Prediction.<\/li>\n\n\n\n<li>Analysis of Marketing.<\/li>\n\n\n\n<li>Gene Selection in Bioinformatics.<\/li>\n\n\n\n<li>Fraud Detection Systems.<\/li>\n<\/ol>\n\n\n\n<p>These domains often involve a large number of variables, so feature selection is very valuable.<\/p>\n\n\n\n<p>Want to learn more about Artificial Intelligence, Machine Learning, and intelligent systems? Explore <strong>HCL GUVI\u2019s<\/strong> <a href=\"https:\/\/www.guvi.in\/courses\/machine-learning-and-ai\/mastering-ai-and-machine-learning\/?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=What+is+Lasso+Regression%3F+An+Introduction+to+L1+Regularisation\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>AI and ML courses<\/strong><\/a> to gain hands-on experience with modern AI technologies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusions<\/strong><\/h2>\n\n\n\n<p>Lasso Regression is one of the most popular regularisation techniques in machine learning. It helps in reducing overfitting, improves model simplicity and does automatic feature selection.<\/p>\n\n\n\n<p>It\u2019s very effective in dealing with datasets with irrelevant features, as it can reduce coefficients to zero.<\/p>\n\n\n\n<p>You can build more accurate and interpretable machine learning systems by understanding L1 regularisation, tuning lambda, sparse models, and feature selection.<\/p>\n\n\n\n<p>If you are dealing with high-dimensional data or noisy data sets, Lasso Regression can be a powerful addition to your machine learning toolbox.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>FAQs<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1779702849770\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>1. The main objective of Lasso Regression is:<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Lasso Regression uses L1 regularisation to reduce overfitting and perform automatic feature selection.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1779702855399\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>2. What is L1 regularisation?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>L1 regularisation adds the sum of the absolute value of the coefficients to the loss function to shrink less important features.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1779702866358\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>3. What is the meaning of the lambda parameter in Lasso Regression?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>The amount of regularisation applied to the model is controlled by the lambda parameter.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1779702875436\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>4. What is the difference between Lasso and Ridge Regression?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Lasso can set coefficients to zero and remove features. Ridge just shrinks coefficients.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1779702888195\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>5. When to use Lasso Regression?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>When datasets contain many irrelevant or superfluous features, Lasso Regression is useful.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Machine learning models tend to overfit the training data and cannot generalise well to unseen data. This is known as overfitting. To solve this, machine learning engineers use regularisation techniques that control model complexity and improve generalisation. Lasso Regression is among the most common regularisation techniques in machine learning. This reduces overfitting and also does [&hellip;]<\/p>\n","protected":false},"author":63,"featured_media":114377,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[933],"tags":[],"views":"45","authorinfo":{"name":"Vishalini Devarajan","url":"https:\/\/www.guvi.in\/blog\/author\/vishalini\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/05\/what-is-lasso-regression-300x115.webp","jetpack_featured_media_url":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/05\/what-is-lasso-regression.webp","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/112097"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=112097"}],"version-history":[{"count":2,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/112097\/revisions"}],"predecessor-version":[{"id":114378,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/112097\/revisions\/114378"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/114377"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=112097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=112097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=112097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}