Member-only story
Day 3: Visualisation in Machine Learning
Introduction
Greetings, data adventurers! On Day 3 of our Machine Learning odyssey, we draw back the curtain on the visual spectacle of ML — data visualisation. It’s the art of turning numbers into narratives, of transforming datasets into visual stories that resonate with both tech wizards and layfolk alike.
The Magic of Visualisation
Data visualisation is like a crystal ball for Machine Learning practitioners. It provides a glimpse into the soul of the data, revealing hidden patterns, trends, and outliers that might otherwise remain unseen in the raw numerical abyss.
Crafting Visual Spells with Matplotlib
Our first tool of the trade is Matplotlib, a Python library that’s as versatile as a Swiss Army knife for data magicians. Install it with a wave of your wand (or, more practically, with pip):
pip install matplotlib
Your First Graphical Incantation
Let’s invoke our first spell to craft a simple line chart. It’s the bread and butter of visualisation — a straightforward way to map the journey of data points across a dimensional plane.
import matplotlib.pyplot as plt
# Sample data
ages = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
salaries = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]
plt.plot(ages, salaries)
plt.title('Average Salary by Age')
plt.xlabel('Ages')
plt.ylabel('Average Salary (USD)')
plt.show()