AI & Machine Learning for Developers
Machine Learning Fundamentals
Machine learning is a way of building software where, instead of writing explicit rules, you show a program many examples and let it find the pattern that connects them. This guide explains what that means concretely — what "training" a model actually does, and the difference between the two most common setups: supervised learning (learning from labeled examples) and unsupervised learning (finding structure with no labels at all). It complements, without duplicating, this site's existing AI Fundamentals course, which covers AI more broadly for a general reader; this guide assumes no prior AI course and goes one level into how the learning part actually works.
Why it matters
- It explains what a "model" actually is
- A trained model is not a hand-written set of if/else rules; it's a set of numeric parameters that were adjusted automatically to fit example data, which is why its behavior on new, unseen input can genuinely surprise its own creators.
- It separates two very different problems
- "I have labeled examples and want to predict a label for new cases" (supervised) and "I have data with no labels and want to find structure in it" (unsupervised) call for different techniques and different ways of judging success.
- It sets realistic expectations for accuracy
- A model's score is only as good as the data and the way it was measured; understanding training versus test data is the difference between a genuinely useful accuracy number and a misleading one.
- It's the foundation under embeddings, RAG, and most applied AI work
- Concepts like embeddings and retrieval, covered elsewhere in this section, are themselves built using the same supervised or self-supervised training ideas explained here.
Learning from examples instead of writing rules
In traditional programming, a developer writes the rules directly: if the total is over some amount, apply a discount. Machine learning inverts this — you provide many examples of inputs and their correct outputs, and an algorithm searches for the numeric parameters that make its own predictions match those examples as closely as possible. That search process is called training. The result, a trained model, is really just a function with parameters that were fit to data rather than typed in by a person, which is why it can generalize to cases nobody explicitly programmed for, and also why it can fail in ways nobody explicitly anticipated.
Supervised learning: examples with known answers
Supervised learning is the more common starting point: every training example comes with a correct answer already attached, called a label. Predicting whether an email is spam (the label is spam or not spam) and predicting a house price from its features (the label is a number) are both supervised problems — the first is classification (predicting a category), the second is regression (predicting a number). The model is judged by how well its predictions match labels it was not shown during training, which is why held-out test data, discussed in this site's Python-for-AI guide, is not optional.
Unsupervised learning: finding structure with no labels
Unsupervised learning starts from data with no correct answers attached at all. Instead of predicting a known label, the goal is to find structure — grouping similar customers together (clustering), or reducing many measurements down to the few that actually explain most of the variation (dimensionality reduction). Because there is no labeled answer to check against, judging whether an unsupervised result is "good" is less clear-cut than with supervised learning, and often comes down to whether a human looking at the groups or patterns finds them useful.
Where this fits with the rest of AI
Modern large language models are trained using ideas adjacent to but distinct from classic supervised/unsupervised learning — self-supervised learning, where the labels are generated automatically from the data itself (predicting the next word in a sentence, for instance). That distinction matters mainly for people building or fine-tuning models; anyone calling an existing model through an API, covered in this section's working-with-LLM-APIs guide, doesn't need to reproduce that training process, only to understand roughly what happened to produce the model they're calling.
Mistakes people make here
- Assuming a high accuracy number means the model is reliable
- Accuracy on the training data, or on a poorly chosen test set, can look excellent while the model performs badly on real, new input — the number is only as trustworthy as the data it was measured on.
- Treating machine learning as a replacement for understanding the problem
- A model finds patterns in the data it's given; if the data doesn't actually contain the pattern you care about, no amount of training fixes that.
- Confusing correlation the model learned with causation
- A model can learn that two things move together in its training data without either one causing the other, and it will still confidently use that pattern to make predictions.
- Expecting a model to explain its own reasoning
- Many models, especially larger ones, don't produce a human-readable reason for a specific prediction; explaining their behavior is its own subfield (interpretability), not a built-in feature.
- Assuming supervised and unsupervised learning are interchangeable
- Which one applies depends entirely on whether labeled answers exist; picking the wrong framing means asking the algorithm to solve a different problem than the one you actually have.
Strengths and trade-offs
Where it is strong
- Once you know supervised versus unsupervised, most applied-AI marketing material becomes much easier to decode into what's actually happening.
- The core idea — fit parameters to examples rather than writing rules — explains a surprisingly wide range of systems, from spam filters to recommendation engines to language models.
- It gives you the vocabulary (training, labels, test data, overfitting) needed to read anything more specific, including this section's guides on embeddings and RAG.
The trade-offs
- "The model learned it from data" is not automatically the same as "the model learned the right thing" — biased or unrepresentative training data produces a biased or unrepresentative model.
- Training a model from scratch takes real data, computing resources, and expertise; most developers will call or fine-tune an existing model rather than train one from nothing.
- A model's confidence in a prediction is not the same as its correctness — a model can be very sure and very wrong.
Who needs this
Anyone building software that calls, evaluates, or reasons about the output of a trained model benefits from this, even without ever training one themselves — it's the mental model that makes phrases like "the model hallucinated" or "overfitting" mean something specific rather than vague blame. If your work only ever consumes a single fixed API with no interest in why it behaves the way it does, you can treat this as optional background.
Questions about machine learning fundamentals
- Do I need to know statistics or linear algebra to understand this?
- Not for the conceptual level covered here. Actually building and tuning models does draw on both, but understanding what supervised and unsupervised learning are, and why test data matters, doesn't require the math.
- How is this different from the site's AI Fundamentals course?
- That course explains AI broadly for a general, non-technical reader. This guide goes one level into the mechanics of how a model is actually trained and evaluated, aimed at developers who will be working with models rather than only using AI products.
- Is machine learning the same thing as AI?
- No. AI is the broader goal (software that performs tasks associated with intelligence); machine learning is the dominant current technique for getting there, but not the only one, and not every AI system is built by training a model on data.
- Can I learn this without writing any code?
- The concepts on this page, yes. Applying them — actually training and evaluating a model — needs code, most commonly in the libraries covered in this section's Python-for-AI-and-ML guide.