◢◤ ARKANE_
SYS_TIME UTC+0
Work with me
/W07

实验Lab: Explore California housing

week 7
Dataset
California housing (20,640 districts, 1990 US Census)
Time
3 hours

This week you'll be able to

  • Run a structured EDA: shape, distributions, relationships, target, data quality.
  • Spot a confounder or a Simpson-style reversal and show it with a grouped view.
  • Choose a chart for a question and write the finding in one sentence.

Goal

Run a structured exploratory analysis and write it up as findings a stakeholder could act on. Find the data problems before any model does.

Data

One row per census block group in California, from the 1990 US Census. The target, MedHouseVal, is the median house value in units of $100,000. It ships with scikit-learn and downloads on first use.

from sklearn.datasets import fetch_california_housing

housing = fetch_california_housing(as_frame=True).frame
housing.describe()

Tasks

  1. Profile the table in five minutes (Procedure 9.1). Note anything odd before you plot anything.
  2. Plot the distribution of every numeric column (Procedure 9.3). Two columns pile up at their maximum. Find them and count the rows. What does that do to a model that predicts house value?
  3. Look at AveRooms, AveBedrms and AveOccup. Find the extreme values (Procedure 9.5). Are they errors or real places?
  4. Compute and plot the correlation matrix (Procedure 9.4). Which feature is most related to the target? Which two features are nearly redundant?
  5. Plot house value against longitude and latitude. Describe the spatial pattern in two sentences.
  6. Split income into quintiles. Compare house value across them with box plots (Procedure 9.6).
  7. Write five findings. Each one gets one chart and one sentence. At least one must be a data-quality warning.

Deliverable

A short EDA report: the five findings, their charts, and a list of the data issues a model must handle.

Done when

  • Both capped columns are found, with counts.
  • Every chart has a title, labelled axes, and units.
  • Each finding is one sentence a non-specialist could read.

Stretch

Fit a quick linear model of house value on income alone. Plot its residuals against the capped values. Show how the cap biases the fit.

online /teaching/semester-1/labs/7 Newcastle, UK v0.1.0 // rss