{"id":3687,"date":"2024-08-16T15:02:09","date_gmt":"2024-08-16T15:02:09","guid":{"rendered":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/"},"modified":"2025-01-08T15:50:42","modified_gmt":"2025-01-08T15:50:42","slug":"squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6","status":"publish","type":"post","link":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/","title":{"rendered":"Squashing the Average: A Dive into Penalized Quantile Regression for Python"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This is my third post on the series about penalized regression. In the first one we talked about how to implement a <a href=\"https:\/\/towardsdatascience.com\/sparse-group-lasso-in-python-255e379ab892\">sparse group lasso in python<\/a>, one of the best variable selection alternatives available nowadays for regression models, and in the second we talked about <a href=\"https:\/\/medium.com\/towards-data-science\/an-adaptive-lasso-63afca54b80d\">adaptive estimators<\/a>, and how they are much better than their traditional counterparts. But today I would like to talk about <strong>quantile regression<\/strong>. and delve into the realm of high-dimensional quantile regression using the robust <strong><code>asgl<\/code> package<\/strong>, focusing on the implementation of quantile regression with an adaptive lasso penalization.<\/p>\n<h3 class=\"wp-block-heading\">Today we will see:<\/h3>\n<ul class=\"wp-block-list\">\n<li>What is quantile regression<\/li>\n<li>What are the advantages of quantile regression compared to traditional least squares regression<\/li>\n<li>How to implement penalized quantile regression models in python<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">What is quantile regression<\/h3>\n<p class=\"wp-block-paragraph\">Let&#8217;s kick things off with something many of us have probably encountered: <strong>least squares regression<\/strong>. This is the classic go-to method when we&#8217;re looking to predict an outcome based on some input variables. It works by finding the line (or hyperplane in higher dimensions) that best fits the data by minimizing the squared differences between observed and predicted values. In simpler terms, it&#8217;s like trying to draw the smoothest line through a scatterplot of data points. <strong>But here&#8217;s the catch: it&#8217;s all about the mean.<\/strong> Least squares regression focuses solely on modeling the average trend in the data.<\/p>\n<p class=\"wp-block-paragraph\">So, what&#8217;s the issue with just modeling the mean? Well, life isn&#8217;t always about averages. Imagine you&#8217;re analyzing income data, which is often skewed by a few high earners. Or consider data with outliers, like real estate prices in a neighborhood with a sudden luxury condo development. In these situations, concentrating on the mean can give a skewed view, potentially leading to misleading insights.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Advantages of quantile regression<\/strong><\/h3>\n<p class=\"wp-block-paragraph\"><strong>Enter quantile regression.<\/strong> Unlike its least squares sibling, quantile regression allows us to explore various quantiles (or percentiles) of the data distribution. This means we can understand how different parts of the data behave, beyond just the average. Want to know how the bottom 10% or the top 90% of your data are reacting to changes in input variables? Quantile regression has got you covered. It&#8217;s especially useful when dealing with data that has outliers or is heavily skewed, as it provides a more nuanced picture by looking at the distribution as a whole. They say one image is worth a thousand words, so let&#8217;s see how quantile regression and least squares regression look like in a couple of simple examples.<\/p>\n<figure class=\"wp-block-image size-large\"><img data-dominant-color=\"f8f9fa\" data-has-transparency=\"true\" style=\"--dominant-color: #f8f9fa;\" loading=\"lazy\" decoding=\"async\" width=\"1827\" height=\"840\" class=\"wp-image-314632 has-transparency\" src=\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/12F-1yb2RgOsxGmPABLPRvg-1.png\" alt=\"Image by author: Examples comparing quantile regression and least squares regression.\" srcset=\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/12F-1yb2RgOsxGmPABLPRvg-1.png 1827w, https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/12F-1yb2RgOsxGmPABLPRvg-1-300x138.png 300w, https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/12F-1yb2RgOsxGmPABLPRvg-1-1024x471.png 1024w, https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/12F-1yb2RgOsxGmPABLPRvg-1-768x353.png 768w, https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/12F-1yb2RgOsxGmPABLPRvg-1-1536x706.png 1536w\" sizes=\"auto, (max-width: 1827px) 100vw, 1827px\" \/><figcaption class=\"wp-element-caption\">Image by author: Examples comparing quantile regression and least squares regression.<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">These two images show very simple regression models with one predictive variable and one response variable. The left image has an outlier on the top right corner (that lonely dot over there). This outlier affects the estimation provided by least squares (the red line), which is way out of way providing very poor predictions. But quantile regression is not affected by outliers, and it&#8217;s predictions are spot-on. On the right image we have a dataset that is heteroscedastic. What does that mean? Picture your data forming a cone shape, widening as the value of X increases. More technically, the variability of our response variable isn&#8217;t playing by the rules &#8211; it expands as X grows. Here, the least squares (red) and quantile regression for the median (green) trace similar paths, but they only tell part of the story. By introducing additional quantiles into the mix(in blue, 10%, 25%, 75% and 90%) we are able to capture how our data dances across the spectrum and see its behavior.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Implementations of quantile regression<\/strong><\/h3>\n<p class=\"wp-block-paragraph\">High-dimensional scenarios, where the number of predictors exceeds the number of observations, are increasingly common in today&#8217;s data-driven world, popping up in fields like genomics, where thousands of genes might predict a single outcome, or in image processing, where countless pixels contribute to a single classification task. These complex situations demand the use of <strong>penalized regression models<\/strong> to manage the multitude of variables effectively. However, most <strong>existing software in R and Python offers limited options for penalizing quantile regression in such high-dimensional contexts.<\/strong><\/p>\n<p class=\"wp-block-paragraph\">This is where my Python package, <strong><code>asgl<\/code><\/strong>, appears. <code>asgl<\/code> package provides a comprehensive framework for <strong>fitting various penalized regression models<\/strong>, including <a href=\"https:\/\/medium.com\/towards-data-science\/sparse-group-lasso-in-python-255e379ab892\">sparse group lasso<\/a> and <a href=\"https:\/\/medium.com\/towards-data-science\/an-adaptive-lasso-63afca54b80d\">adaptive lasso<\/a> &#8211; techniques I&#8217;ve previously talked about in other posts. It is built on cutting-edge research and offers <strong>full compatibility with scikit-learn<\/strong>, allowing seamless integration with other machine learning tools.<\/p>\n<h3 class=\"wp-block-heading\">Example (with code!)<\/h3>\n<p class=\"wp-block-paragraph\">Let&#8217;s see how we can use <code>asgl<\/code> to perform quantile regression with an adaptive lasso penalization. First, ensure the <code>asgl<\/code> library is installed:<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">pip install asgl<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Next, we&#8217;ll demonstrate the implementation using synthetic data:<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-undefined\">import numpy as np\nfrom sklearn.datasets import make_regression\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import mean_absolute_error\nfrom asgl import Regressor\n\n# Generate synthetic data\nX, y = make_regression(n_samples=100, n_features=200, n_informative=10, noise=0.1, random_state=42)\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# Define and train the quantile regression model with adaptive lasso\nmodel = Regressor(model=&#039;qr&#039;, penalization=&#039;alasso&#039;, quantile=0.5)\n\n# Fit the model\nmodel.fit(X_train, y_train)\n\n# Make predictions\npredictions = model.predict(X_test)\n\n# Evaluate the model\nmae = mean_absolute_error(y_test, predictions)\nprint(f&#039;Mean Absolute Error: {mse:.3f}&#039;)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">In this example, we generate a dataset with 100 samples and 200 features, where only 10 features are truly informative making it a high dimensional regression problem). The <code>Regressor<\/code> class from the <code>asgl<\/code> package is configured to perform quantile regression (by selecting <code>model=&#039;qr&#039;<\/code>) for the median (by selecting <code>quantile=0.5<\/code>). If we are interested in other quantiles, we just need to set the new quantile value somewhere in the (0, 1) interval. We solve an adaptive lasso penalization (by selecting <code>penalization=&#039;alasso&#039;<\/code>), and we could optimize other aspects of the model like how the adaptive weights are estimated etc, or use the default configuration.<\/p>\n<h3 class=\"wp-block-heading\">Advantages of <code>asgl<\/code><\/h3>\n<p class=\"wp-block-paragraph\">Let me finish by summarising the benefits of <code>asgl<\/code>:<\/p>\n<ol class=\"wp-block-list\">\n<li><strong>Scalability<\/strong>: The package efficiently handles high-dimensional datasets, making it suitable for applications in a wide range of scenarios.<\/li>\n<li><strong>Flexibility<\/strong>: With support for various models and penalizations, <code>asgl<\/code> caters to diverse analytical needs.<\/li>\n<li><strong>Integration<\/strong>: Compatibility with scikit-learn simplifies model evaluation and hyperparameter tuning<\/li>\n<\/ol>\n<p class=\"wp-block-paragraph\">And that&#8217;s it on this post about quantile regression! By squashing the average and exploring the full distribution of the data, we open up new possibilities for data-driven decision-making. Stay tuned for more insights into the world of penalized regression and the <code>asgl<\/code> library.<\/p>","protected":false},"excerpt":{"rendered":"<p>How to build penalized quantile regression models (with code!)<\/p>\n","protected":false},"author":18,"featured_media":3688,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"is_member_only":true,"sub_heading":"How to build penalized quantile regression models (with code!)","footnotes":""},"categories":[44,14668],"tags":[457,448,467,607,459],"sponsor":[],"coauthors":[26711],"class_list":["post-3687","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-science","category-statistics","tag-data-analysis","tag-data-science","tag-python","tag-regression","tag-statistics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Squashing the Average: A Dive into Penalized Quantile Regression for Python | Towards Data Science<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Squashing the Average: A Dive into Penalized Quantile Regression for Python | Towards Data Science\" \/>\n<meta property=\"og:description\" content=\"How to build penalized quantile regression models (with code!)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/\" \/>\n<meta property=\"og:site_name\" content=\"Towards Data Science\" \/>\n<meta property=\"article:published_time\" content=\"2024-08-16T15:02:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-08T15:50:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1125\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"\u00c1lvaro M\u00e9ndez Civieta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@TDataScience\" \/>\n<meta name=\"twitter:site\" content=\"@TDataScience\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u00c1lvaro M\u00e9ndez Civieta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/\"},\"author\":{\"name\":\"TDS Editors\",\"@id\":\"https:\/\/towardsdatascience.com\/#\/schema\/person\/f9925d336b6fe962b03ad8281d90b8ee\"},\"headline\":\"Squashing the Average: A Dive into Penalized Quantile Regression for Python\",\"datePublished\":\"2024-08-16T15:02:09+00:00\",\"dateModified\":\"2025-01-08T15:50:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/\"},\"wordCount\":974,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/towardsdatascience.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png\",\"keywords\":[\"Data Analysis\",\"Data Science\",\"Python\",\"Regression\",\"Statistics\"],\"articleSection\":[\"Data Science\",\"Statistics\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/\",\"url\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/\",\"name\":\"Squashing the Average: A Dive into Penalized Quantile Regression for Python | Towards Data Science\",\"isPartOf\":{\"@id\":\"https:\/\/towardsdatascience.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png\",\"datePublished\":\"2024-08-16T15:02:09+00:00\",\"dateModified\":\"2025-01-08T15:50:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage\",\"url\":\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png\",\"contentUrl\":\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png\",\"width\":2000,\"height\":1125,\"caption\":\"Photo by Joes Valentine \/ Unsplash: Imagine these are normal distributions.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/towardsdatascience.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Squashing the Average: A Dive into Penalized Quantile Regression for Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/towardsdatascience.com\/#website\",\"url\":\"https:\/\/towardsdatascience.com\/\",\"name\":\"Towards Data Science\",\"description\":\"Publish AI, ML &amp; data-science insights to a global community of data professionals.\",\"publisher\":{\"@id\":\"https:\/\/towardsdatascience.com\/#organization\"},\"alternateName\":\"TDS\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/towardsdatascience.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/towardsdatascience.com\/#organization\",\"name\":\"Towards Data Science\",\"alternateName\":\"TDS\",\"url\":\"https:\/\/towardsdatascience.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/towardsdatascience.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2025\/02\/tds-logo.jpg\",\"contentUrl\":\"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2025\/02\/tds-logo.jpg\",\"width\":696,\"height\":696,\"caption\":\"Towards Data Science\"},\"image\":{\"@id\":\"https:\/\/towardsdatascience.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/TDataScience\",\"https:\/\/www.youtube.com\/c\/TowardsDataScience\",\"https:\/\/www.linkedin.com\/company\/towards-data-science\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/towardsdatascience.com\/#\/schema\/person\/f9925d336b6fe962b03ad8281d90b8ee\",\"name\":\"TDS Editors\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/towardsdatascience.com\/#\/schema\/person\/image\/23494c9101089ad44ae88ce9d2f56aac\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"TDS Editors\"},\"description\":\"Building a vibrant data science and machine learning community. Share your insights and projects with our global audience: bit.ly\/write-for-tds\",\"url\":\"https:\/\/towardsdatascience.com\/author\/towardsdatascience\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Squashing the Average: A Dive into Penalized Quantile Regression for Python | Towards Data Science","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/","og_locale":"en_US","og_type":"article","og_title":"Squashing the Average: A Dive into Penalized Quantile Regression for Python | Towards Data Science","og_description":"How to build penalized quantile regression models (with code!)","og_url":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/","og_site_name":"Towards Data Science","article_published_time":"2024-08-16T15:02:09+00:00","article_modified_time":"2025-01-08T15:50:42+00:00","og_image":[{"width":2000,"height":1125,"url":"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png","type":"image\/png"}],"author":"\u00c1lvaro M\u00e9ndez Civieta","twitter_card":"summary_large_image","twitter_creator":"@TDataScience","twitter_site":"@TDataScience","twitter_misc":{"Written by":"\u00c1lvaro M\u00e9ndez Civieta","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#article","isPartOf":{"@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/"},"author":{"name":"TDS Editors","@id":"https:\/\/towardsdatascience.com\/#\/schema\/person\/f9925d336b6fe962b03ad8281d90b8ee"},"headline":"Squashing the Average: A Dive into Penalized Quantile Regression for Python","datePublished":"2024-08-16T15:02:09+00:00","dateModified":"2025-01-08T15:50:42+00:00","mainEntityOfPage":{"@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/"},"wordCount":974,"commentCount":0,"publisher":{"@id":"https:\/\/towardsdatascience.com\/#organization"},"image":{"@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage"},"thumbnailUrl":"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png","keywords":["Data Analysis","Data Science","Python","Regression","Statistics"],"articleSection":["Data Science","Statistics"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/","url":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/","name":"Squashing the Average: A Dive into Penalized Quantile Regression for Python | Towards Data Science","isPartOf":{"@id":"https:\/\/towardsdatascience.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage"},"image":{"@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage"},"thumbnailUrl":"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png","datePublished":"2024-08-16T15:02:09+00:00","dateModified":"2025-01-08T15:50:42+00:00","breadcrumb":{"@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#primaryimage","url":"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png","contentUrl":"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2024\/08\/1TyMiZh4mUBtfdpon5QnRFQ.png","width":2000,"height":1125,"caption":"Photo by Joes Valentine \/ Unsplash: Imagine these are normal distributions."},{"@type":"BreadcrumbList","@id":"https:\/\/towardsdatascience.com\/squashing-the-average-a-dive-into-penalized-quantile-regression-for-python-8f3a996768b6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/towardsdatascience.com\/"},{"@type":"ListItem","position":2,"name":"Squashing the Average: A Dive into Penalized Quantile Regression for Python"}]},{"@type":"WebSite","@id":"https:\/\/towardsdatascience.com\/#website","url":"https:\/\/towardsdatascience.com\/","name":"Towards Data Science","description":"Publish AI, ML &amp; data-science insights to a global community of data professionals.","publisher":{"@id":"https:\/\/towardsdatascience.com\/#organization"},"alternateName":"TDS","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/towardsdatascience.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/towardsdatascience.com\/#organization","name":"Towards Data Science","alternateName":"TDS","url":"https:\/\/towardsdatascience.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/towardsdatascience.com\/#\/schema\/logo\/image\/","url":"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2025\/02\/tds-logo.jpg","contentUrl":"https:\/\/towardsdatascience.com\/wp-content\/uploads\/2025\/02\/tds-logo.jpg","width":696,"height":696,"caption":"Towards Data Science"},"image":{"@id":"https:\/\/towardsdatascience.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/TDataScience","https:\/\/www.youtube.com\/c\/TowardsDataScience","https:\/\/www.linkedin.com\/company\/towards-data-science\/"]},{"@type":"Person","@id":"https:\/\/towardsdatascience.com\/#\/schema\/person\/f9925d336b6fe962b03ad8281d90b8ee","name":"TDS Editors","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/towardsdatascience.com\/#\/schema\/person\/image\/23494c9101089ad44ae88ce9d2f56aac","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"TDS Editors"},"description":"Building a vibrant data science and machine learning community. Share your insights and projects with our global audience: bit.ly\/write-for-tds","url":"https:\/\/towardsdatascience.com\/author\/towardsdatascience\/"}]}},"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Towards Data Science","distributor_original_site_url":"https:\/\/towardsdatascience.com","push-errors":false,"_links":{"self":[{"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/posts\/3687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/comments?post=3687"}],"version-history":[{"count":0,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/posts\/3687\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/media\/3688"}],"wp:attachment":[{"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/media?parent=3687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/categories?post=3687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/tags?post=3687"},{"taxonomy":"sponsor","embeddable":true,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/sponsor?post=3687"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/towardsdatascience.com\/wp-json\/wp\/v2\/coauthors?post=3687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}