Data Exploration and Visualisation
Related: 2. Supervised Learning | 3. Unsupervised Learning | Artificial Intelligence
Why Data Visualisation?
Summary statistics alone can be misleading — datasets with identical summary statistics (mean, standard deviation, correlation) can have completely different distributions. This was demonstrated by Anscombe’s Quartet (1973) and the Datasaurus Dozen.
Key principle: Always produce both calculations and graphs. Each contributes to understanding.
Purposes of Visualisation
Data visualisation is a critical tool in AI for identifying summaries, structure, relationships, differences, and abnormalities in data. It communicates complex information effectively.
Chart Types by Purpose
| Purpose | Chart Types |
|---|---|
| Relationship | Scatter plots, bubble charts |
| Composition | Pie charts, stacked bar charts |
| Connection | Network graphs |
| Location | Maps, geographic plots |
| Comparison | Bar charts, grouped bar charts |
Grammar of Graphics
The grammar of graphics is a systematic framework for building plots from components. Learning the grammar helps you think about new graphics beyond pre-existing templates.
Core components:
| Component | Role |
|---|---|
| Data | The dataset being visualised |
| Aesthetics | Mapping variables to visual properties (x, y, colour, shape, size) |
| Geometries | The visual marks (points, lines, bars) |
| Facets | Subplots for subsets of data |
| Statistics | Statistical transformations (smoothing, binning) |
| Coordinates | The coordinate system (Cartesian, polar) |
| Theme | Non-data visual styling |
Data Preparation (Data Wrangling)
Data quality issues to address:
- Missing values — remove or impute
- Duplicate records — merge
- Invalid values — generate best estimate
- Noise — filter or smooth
- Outliers — detect and handle
Feature engineering:
- Feature selection — remove highly correlated features, features with many missing values, irrelevant features (IDs, row numbers)
- Combining features — create new informative features
- Feature transformation — mapping values to a new representation to make analysis easier (e.g., scaling, normalisation)