Statistics and Linear Algebra
Introduction
Welcome back, aspiring data alchemists, to Day 4 of our quest into the realm of Machine Learning (ML)! Having conquered the lands of Python basics and the visual arts of data, it’s time to wade into the mystical waters of statistics and linear algebra. Fear not, for these waters, though deep, are where the true powers of ML lie dormant, waiting to be awakened.
Statistics: The Crystal Ball of Machine Learning
Statistics is the crystal ball through which ML practitioners foresee outcomes and extract hidden gems of wisdom from data.
Descriptive Statistics: Painting the Portrait of Data
Begin with descriptive statistics, the art of describing and summarising data. It’s like sketching the outlines before painting the full picture.
import numpy as np
# Sample data - Ages of a group of wizards
wizard_ages = np.array([105, 120, 93, 87, 135, 81, 108, 92, 110, 114])
# Calculating basic statistics
mean_age = np.mean(wizard_ages)
median_age = np.median(wizard_ages)
age_variance = np.var(wizard_ages)
age_standard_deviation = np.std(wizard_ages)
print(f"Mean Age: {mean_age}")
print(f"Median Age: {median_age}")
print(f"Age Variance: {age_variance}")
print(f"Age Standard Deviation: {age_standard_deviation}")