Skip to content
matthewcm.dev

    ↑ ↓ move · ↵ open · tab scopeopen graph →

    Machine Learning

    Learning patterns from data instead of hand-coding rules — supervised, unsupervised and reinforcement learning, and the habit of testing on data the model has never seen.

    Growingtended planted 2 min read
    On this page

    Machine learning is what you reach for when the rules are too fiddly to write by hand. Instead of coding “if the email mentions a prize and has three exclamation marks, it’s spam”, you show a model thousands of labelled emails and let it fit the pattern itself. It runs through my degree (AI and machine learning was the thread of my final year), my dissertation, and most of what I read about AI today.

    Three families

    SupervisedUnsupervisedReinforcement
    Datainputs with known labelsinputs onlyan environment that hands out rewards
    Goalpredict the label for new inputsfind structurelearn a policy that maximises reward
    Typical tasksclassification, regressionclustering, dimensionality reduction, topic modelling, anomaly detectiongames, robotics, control
    Example algorithmsdecision trees, random forests, SVMs, naive Bayes, k-nearest neighbours, neural networksk-means, hierarchical clustering, PCA, LDA topic modelsQ-learning, PPO

    Semi-supervised and self-supervised learning sit in between. Self-supervision — predicting the next word, or a masked word — is how modern language models pre-train on oceans of unlabelled text. More on the third column in Reinforcement Learning, and on layered neural networks in Deep Learning.

    The idea that matters most: generalisation

    A model that scores 100% on its training data may have learnt nothing except the training data. So you split:

    • Training set — the model learns from it.
    • Validation set — you tune choices (depth of a tree, learning rate) against it.
    • Test set — touched once, at the end, to estimate how the model will do on data it has never seen.

    Overfitting is memorising noise; underfitting is a model too simple to capture the signal. The bias–variance trade-off is the tension between them. Accuracy alone also lies on imbalanced data — a fraud model that always says “not fraud” is 99.9% accurate and useless — which is why precision, recall and confusion matrices exist.

    A small example

    Say you want to group support tickets without labels. An unsupervised topic model might discover clusters that turn out to be “billing”, “login problems” and “feature requests”. Once a human names those clusters and labels a few hundred tickets, you can train a supervised classifier to route new tickets automatically. Unsupervised to explore, supervised to automate — a pattern I used on forum data at university (Pathways into Cybercrime).

    In practice

    Most of the ML I touch now is through pre-trained models rather than training my own, but the fundamentals keep paying off: be suspicious of a demo that was only evaluated on the examples it was tuned on, ask what the model was rewarded for, and remember that the hardest part is usually the data, not the algorithm. When I evaluate an LLM feature, I’m still doing train/test hygiene — just with prompts and eval sets instead of decision trees.

    • #machine-learning
    • #supervised-learning
    • #unsupervised-learning
    • #ai

    ↪ Links to (3)