AI, machine learning and deep learning · Introductory

Explore and Visualize the Data to Gain Insights

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

Data exploration requires isolating the training set and creating a copy to preserve the original state while experimenting. Visualizing geographical data with transparency and multivariate attributes like population and price reveals density clusters and correlations with housing values.

Intuition

When exploring data, the goal is to find patterns without contaminating your test set or losing your original data. By creating a copy of the training set, you can freely manipulate variables knowing you can revert to the start. Visuals are crucial because raw numbers hide structure; for instance, overlapping points in a map can obscure where data is actually dense. By adjusting transparency and mapping additional attributes like population size to circle radius and price to color, you transform a static map into a dynamic tool that highlights where high-value, high-density areas exist, such as near the ocean.

Derivation

  1. Separate the test set to ensure the training set remains pure for exploration.
  2. Create a copy of the training dataset (e.g., housing = strat_train_set.copy()) to allow safe experimentation.
  3. Plot latitude vs. longitude with α=0.2 to reveal density clusters in large datasets.
  4. Map population to circle size (s) and median house value to color (c) to visualize multivariate relationships.
  5. Analyze the resulting plot to identify correlations between location, density, and price.

Worked example

Problem

You have a large housing dataset and need to visualize the relationship between location, population, and median house value to identify high-value clusters.

  1. Ensure the test set is set aside and only the training set is explored.
  2. Create a copy of the training set: housing = strat_train_set.copy().
  3. Generate a scatterplot using longitude and latitude.
  4. Set α=0.2 to handle overlapping points and reveal density.
  5. Set s=housing['population'] / 100 to size circles by population.
  6. Set c='median_house_value' and cmap='jet' to color-code by price.
  7. Observe that prices correlate with proximity to the ocean and population density.

Answer The visualization reveals that housing prices correlate strongly with location (proximity to the ocean) and population density, indicating that clustering algorithms could be useful for detecting main clusters.

Common mistakes

  • Assuming that a basic scatterplot without transparency adjustments will clearly show patterns in dense datasets.
  • Believing that ocean proximity is a simple rule for high prices, ignoring regional variations like those in Northern California.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

This is a text lesson: it has no animation code yet.

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.