What Is Machine Learning?

The big picture of AI and machine learning — learning from data instead of rules, supervised, unsupervised, self-supervised and reinforcement learning, the ML workflow, features and labels, generalisation, and where deep learning and LLMs fit.

Beginner 4 min readLesson 1 of 14

Machine learning (ML) is the practice of building programs that learn patterns from data instead of following hand-written rules.

Traditional programming

Rules + data → answers.

A programmer writes if subject contains "lottery" and sender unknown → spam. Every case must be anticipated; rules break as spammers adapt.

Machine learning

Data + answers → rules.

Show the algorithm thousands of emails labelled spam / not spam; it learns a function that classifies new emails, and can be retrained as patterns change.

ML shines when rules are too complex to write (recognising faces, translating language), when patterns change over time (fraud), or when you need to find structure humans can't see (recommendations).

AI, ML, deep learning, generative AI

Artificial intelligencemachines performing tasks that require intelligence — includes search, planning, logic, MLMachine learningsystems that improve from dataDeep learningML with many-layered neural networksGenerative AI / LLMsdeep models that generate text, images, code, audio

Types of learning

TypeDataGoalExamples
SupervisedInputs with labelsPredict the label for new inputsSpam detection, house prices, image classification, diagnosis
UnsupervisedInputs without labelsFind structureCustomer segmentation (clustering), anomaly detection, dimensionality reduction
Self-supervisedUnlabelled data where the labels come from the data itselfLearn general representationsLLMs predicting the next word; masked image modelling
Reinforcement learningAn agent acting in an environment, receiving rewardsLearn a policy maximising rewardGame playing (AlphaGo), robotics, RLHF for chatbots

Supervised learning splits into:

  • Regression: predict a number (price, temperature, delivery time).
  • Classification: predict a category (spam/not spam, digit 0–9, cat/dog/bird).

Vocabulary

TermMeaning
Example / sampleOne data point (an email, a house)
FeaturesThe inputs describing an example (square metres, bedrooms, location) — the vector x
Label / targetThe answer to predict (the price) — y
ModelA function with adjustable parameters (weights) mapping features to predictions
TrainingAdjusting parameters to minimise a loss (error) on training data
InferenceUsing the trained model to predict on new data
HyperparametersSettings chosen before training (learning rate, tree depth, number of layers)

The ML workflow

  1. Frame the problem: what decision does the prediction support? What metric defines success? Is ML even needed — would a simple rule work?
  2. Collect and label data: often the hardest and most important step.
  3. Explore and clean: missing values, outliers, errors, leakage, class imbalance.
  4. Feature engineering: transform raw data into useful inputs (deep learning automates much of this).
  5. Split the data: training, validation and test sets.
  6. Train candidate models, starting with a simple baseline.
  7. Evaluate on validation data, tune hyperparameters, then report final performance on the untouched test set (Model evaluation).
  8. Deploy and monitor: watch for data drift and degrading accuracy; retrain (MLOps).

Generalisation: the central challenge

The goal isn't to do well on training data — a lookup table can memorise that — but to generalise to data the model has never seen.

ProblemSymptomCauseFixes
Underfitting (high bias)Poor on training and test dataModel too simpleMore features, a more expressive model, train longer
Overfitting (high variance)Great on training, poor on testModel memorises noiseMore data, regularisation, simpler model, early stopping, dropout

The bias–variance trade-off describes this tension. This is why we always evaluate on held-out data.

A first model in a few lines

Python
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import classification_report

X, y = load_breast_cancer(return_X_y=True)                 # 569 tumours, 30 features, benign/malignant
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, stratify=y, random_state=42)

model = make_pipeline(StandardScaler(), LogisticRegression(max_iter=1000))
model.fit(X_train, y_train)                                # training
print(classification_report(y_test, model.predict(X_test)))  # evaluation on unseen data

Where deep learning and LLMs fit

Classical ML (linear models, decision trees, gradient boosting — Classical ML algorithms) excels on tabular data with meaningful features. Deep learning (Neural networks) dominates unstructured data — images, audio, text — learning features automatically from raw inputs given lots of data and compute. Large language models (LLMs) are huge transformers trained with self-supervision on internet-scale text, then adapted to follow instructions.

Limits and responsibilities

  • Models learn correlations, not causation, and only what's in the data.
  • Bias in data becomes bias in predictions (hiring, lending, policing) — measure fairness across groups.
  • Models can be confidently wrong, especially on inputs unlike the training data (distribution shift).
  • Privacy, explainability, security (adversarial examples, prompt injection) and regulation (e.g. the EU AI Act) matter in production.
Key takeaways
  • ML learns rules from data and answers instead of having them hand-coded.
  • AI ⊃ ML ⊃ deep learning ⊃ generative models and LLMs.
  • Supervised (regression, classification), unsupervised, self-supervised and reinforcement learning.
  • Workflow: frame, collect, clean, featurise, split, train baseline, evaluate, deploy, monitor.
  • The goal is generalisation; underfitting and overfitting are the two failure modes.
  • Classical ML wins on tabular data; deep learning on images, audio and text.