Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Ames Housing — Categorical Encoding

Demonstrates three categorical encoding techniques on the Ames Housing dataset, each applied to a column chosen because it fits that method best.

Encodings

Technique Column Why this column
Label Encoding Kitchen Qual Ordinal — natural rank order (Poor < Fair < Typical/Average < Good < Excellent)
One-Hot Encoding Bldg Type Nominal, low cardinality (5 categories, no order)
Frequency Encoding Neighborhood Nominal, high cardinality (28 categories) — one-hot would create too many sparse columns

Contents

  • Ames_Housing_Encodings.ipynb — full notebook: data inspection, all three encodings (each in its own dataframe copy with validation checks), pre-/post-encoding visualizations, and a correlation matrix against SalePrice
  • AmesHousing.csv — dataset used

Notebook sections

  1. Setup & load data
  2. Inspect target columns for missing values
  3. Label encoding — Kitchen Qual
  4. One-hot encoding — Bldg Type
  5. Frequency encoding — Neighborhood
  6. Summary table
  7. Visualizations — pre-encoding distributions, post-encoding distributions, correlation matrix

Key finding

Kitchen Qual_Label correlates strongly with SalePrice (r ≈ 0.67) — kitchen quality is a meaningful price driver in this dataset. The one-hot Bldg Type columns show negative correlation with each other, which is expected: the categories are mutually exclusive by construction.

Requirements

pandas
scikit-learn
matplotlib
seaborn

Usage

jupyter notebook Ames_Housing_Encodings.ipynb

About

Practical implementation of categorical encoding techniques on the Ames Housing dataset using Label Encoding, One-Hot Encoding, and Frequency Encoding, with visualizations and correlation analysis against SalePrice.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages