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

PurposeChart Types
RelationshipScatter plots, bubble charts
CompositionPie charts, stacked bar charts
ConnectionNetwork graphs
LocationMaps, geographic plots
ComparisonBar 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:

ComponentRole
DataThe dataset being visualised
AestheticsMapping variables to visual properties (x, y, colour, shape, size)
GeometriesThe visual marks (points, lines, bars)
FacetsSubplots for subsets of data
StatisticsStatistical transformations (smoothing, binning)
CoordinatesThe coordinate system (Cartesian, polar)
ThemeNon-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)