<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb" -->

---
title: Linear Discriminant Analysis (LDA) in Real-Life:...
description: Linear Discriminant Analysis (LDA) is explained as a supervised dimensionality reduction technique used ahead of classification tasks, covering its assumptions...
canonical: https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Linear Discriminant Analysis (LDA) in Real-Life: Dimensionality Reduction in a Real-Estate Dataset | daily.dev
og:description: Linear Discriminant Analysis (LDA) is explained as a supervised dimensionality reduction technique used ahead of classification tasks, covering its assumptions...
og:url: https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb
og:image: https://api.daily.dev/og/posts/mRJBr3clB.png
og:image:alt: Linear Discriminant Analysis (LDA) in Real-Life: Dimensionality Reduction in a Real-Estate Dataset
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Linear Discriminant Analysis (LDA) in Real-Life: Dimensionality Reduction in a Real-Estate Dataset

**[Towards Data Science](https://daily.dev/sources/tds)** · 21 min read · 0 upvotes · 0 comments

## Summary

Linear Discriminant Analysis (LDA) is explained as a supervised dimensionality reduction technique used ahead of classification tasks, covering its assumptions (linear separability, Gaussian distribution, shared covariance), its mathematical grounding in the Bayes Classifier, and how it compares to PCA. A worked example applies scikit-learn's LinearDiscriminantAnalysis to a real-estate dataset with 17 features and 3 property-type classes, walking through fitting the model, visualizing class separation and decision boundaries in 2D, and interpreting feature contributions via the scalings and explained_variance_ratio_ attributes to determine which features (bedrooms, garage, laundry_hookups) most distinguish property types.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://towardsdatascience.com/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset>

## Questions this post answers

### What is the maximum number of linear discriminants that LDA can produce for a classification problem?

The maximum number of linear discriminants is the minimum between the number of features and the number of classes minus one (K-1), where K is the total number of classes. In practice, the LDA algorithm computes eigenvectors for all features, but only K-1 of them are non-zero and usable as discriminants.

_daily.dev surfaces practical walkthroughs like this for engineers choosing dimensionality reduction techniques._

### What is the main difference between Linear Discriminant Analysis and Principal Component Analysis for dimensionality reduction?

LDA is a supervised method that uses class labels to compute discriminants maximizing between-class separation, while PCA is unsupervised and computes eigenvectors ranked by variance without regard to labels. PCA has no cap on the number of components it can produce, whereas LDA is limited to K-1 discriminants, where K is the number of classes.

_Developers comparing LDA and PCA for feature reduction can find grounded explainers like this through daily.dev._

### How do you interpret feature contributions from scikit-learn's LinearDiscriminantAnalysis scalings attribute?

The scalings attribute of scikit-learn's LinearDiscriminantAnalysis (with solver='eigen') gives raw eigenvector values showing how much each feature contributes to each linear discriminant, but these are not on a 0-100% scale. Normalizing each discriminant's column so contributions sum to 100% makes relative feature importance far easier to interpret, though importance still cannot be compared across different discriminants.

_daily.dev helps practitioners working through scikit-learn model interpretation find hands-on examples like this._

## Similar posts on daily.dev

- [The Machine Learning “Advent Calendar” Day 3: GNB, LDA and QDA in Excel](https://daily.dev/posts/the-machine-learning-advent-calendar-day-3-gnb-lda-and-qda-in-excel-cqfvmm0vw) · Towards Data Science · 0 upvotes · 0 comments
- [Understanding the Role of Latent Space in Machine Learning Models](https://daily.dev/posts/understanding-the-role-of-latent-space-in-machine-learning-models-h21ywyxnu) · Machine Learning Mastery · 3 upvotes · 0 comments
- [From Customer Segments to Reliable Anomalies: K-Means, PCA, Missing Data, and DBSCAN — Machine Learning in Analytical Tasks Part 2](https://daily.dev/posts/from-customer-segments-to-reliable-anomalies-k-means-pca-missing-data-and-dbscan-machine-learn-swllyysyc) · Medium · 0 upvotes · 0 comments
- [PCA: an embedding shrink-ray](https://daily.dev/posts/pca-an-embedding-shrink-ray-ayowx3qqb) · Software Doug · 0 upvotes · 0 comments

---

Tags: [#machine-learning](https://daily.dev/tags/machine-learning), [#python](https://daily.dev/tags/python), [#scikit](https://daily.dev/tags/scikit)

[View this post on daily.dev](https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Linear Discriminant Analysis (LDA) in Real-Life: Dimensionality Reduction in a Real-Estate Dataset","url":"https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb"},"datePublished":"2026-09-06T12:01:00.944Z","dateModified":"2026-09-14T06:34:02.424Z","description":"Linear Discriminant Analysis (LDA) is explained as a supervised dimensionality reduction technique used ahead of classification tasks, covering its assumptions...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ac291a31a9d00eb2642a49f7c34ae979?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ac291a31a9d00eb2642a49f7c34ae979?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Towards Data Science","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Towards Data Science","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/tds","url":"https://daily.dev/sources/tds"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"machine-learning,python,scikit","timeRequired":"PT21M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Towards Data Science","item":"https://daily.dev/sources/tds"},{"@type":"ListItem","position":3,"name":"Linear Discriminant Analysis (LDA) in Real-Life: Dimensionality Reduction in a Real-Estate Dataset"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/linear-discriminant-analysis-lda-in-real-life-dimensionality-reduction-in-a-real-estate-dataset-mrjbr3clb#faq","mainEntity":[{"@type":"Question","name":"What is the maximum number of linear discriminants that LDA can produce for a classification problem?","acceptedAnswer":{"@type":"Answer","text":"The maximum number of linear discriminants is the minimum between the number of features and the number of classes minus one (K-1), where K is the total number of classes. In practice, the LDA algorithm computes eigenvectors for all features, but only K-1 of them are non-zero and usable as discriminants. daily.dev surfaces practical walkthroughs like this for engineers choosing dimensionality reduction techniques."}},{"@type":"Question","name":"What is the main difference between Linear Discriminant Analysis and Principal Component Analysis for dimensionality reduction?","acceptedAnswer":{"@type":"Answer","text":"LDA is a supervised method that uses class labels to compute discriminants maximizing between-class separation, while PCA is unsupervised and computes eigenvectors ranked by variance without regard to labels. PCA has no cap on the number of components it can produce, whereas LDA is limited to K-1 discriminants, where K is the number of classes. Developers comparing LDA and PCA for feature reduction can find grounded explainers like this through daily.dev."}},{"@type":"Question","name":"How do you interpret feature contributions from scikit-learn's LinearDiscriminantAnalysis scalings attribute?","acceptedAnswer":{"@type":"Answer","text":"The scalings attribute of scikit-learn's LinearDiscriminantAnalysis (with solver='eigen') gives raw eigenvector values showing how much each feature contributes to each linear discriminant, but these are not on a 0-100% scale. Normalizing each discriminant's column so contributions sum to 100% makes relative feature importance far easier to interpret, though importance still cannot be compared across different discriminants. daily.dev helps practitioners working through scikit-learn model interpretation find hands-on examples like this."}}]}
```

