Machine Learning Basics: What a Model Actually Does
Training, features, and predictions made simple โ the mental model every AI student needs, from supervised learning to inference, in plain language.
Three ingredients of every ML project
Every machine learning project, from a spam filter to a large language model, is made of the same three parts.
- Data โ examples: rows of numbers, images, or text.
- Features โ the measurable properties the model reads from each example.
- Learning algorithm โ the math that tunes the model's internal parameters until its predictions match the data well enough.
That is the whole recipe. What varies enormously between projects is the size of each ingredient and how well you understand it, but the structure never changes.
What "learning" actually means
A model is a very large function with adjustable internal numbers called parameters โ for a small model maybe thousands, for a large one hundreds of billions. Training means repeatedly adjusting those parameters so that when the model sees an input, its output is as close as possible to the correct answer.
Concretely, a training loop does four things over and over: make a prediction, measure how wrong it was with a loss function, work out which direction each parameter should move to reduce that error, and nudge them that way. Repeat across the dataset many times and the model slowly converges on a function that captures the pattern.
A useful mental model: you never write the function yourself. The data reveals it, and your job is to set up the process that finds it.
Training vs inference
During training, the model adjusts its parameters to reduce mistakes on the data it can see. During inference, the trained model makes predictions on new, unseen input.
This split matters more than it first appears, because it explains a whole category of ML problems. If a model performs well on its training data but badly on new data, it has overfitted โ it memorised the examples instead of learning the pattern. The usual fixes are more data, simpler models, or explicit regularisation that penalises large parameter values.
Common types
- Supervised learning โ data comes with labels (spam or not spam). The model learns a mapping from input to a known answer. Most classical ML is this.
- Unsupervised learning โ no labels; the model finds clusters and structure itself. Useful for customer segmentation or grouping similar documents.
- Reinforcement learning โ an agent learns by taking actions in an environment and receiving rewards or penalties. This is how most game-playing systems and some robotics work.
A fourth category worth knowing is self-supervised learning, which turns unlabeled data into its own training signal by hiding part of the input and asking the model to predict it. This is the trick behind every large language model: hide the next word, predict it, repeat.
How you know if it worked
Accuracy alone is a trap, especially with imbalanced data. If 1% of transactions are fraud, a model that always answers "not fraud" scores 99% accuracy and is completely useless. This is why practitioners read a confusion matrix โ true positives, false positives, true negatives, false negatives โ and pick a metric that matches the actual cost of each mistake. Precision and recall, and the F1 score that balances them, are the usual tools.
Master the vocabulary above, then build one regression and one classification project. That hands-on loop is worth a semester of slides, because every concept here becomes concrete the moment you watch a model fail on real data.
Go deeper
- Read how LLMs like ChatGPT really work to see ML applied to language.
- Follow the 90-day AI roadmap to structure practice week by week.
- Explore the Agentic AI Engineer program our curriculum teaches step by step.
Related reading
AI Photo: How Artificial Intelligence Creates and Edits Images
What an AI photo is, how text-to-image generation works, and why the LLMs, RAG and agents behind it are where the real engineering starts.
Generative AI Roadmap for Beginners
A learning roadmap for generative AI that starts with what the technology actually is, moves through prompting and retrieval, and ends at evaluation and deployment โ with the prerequisites stated up front.
How to Become an AI Engineer: 90-Day Roadmap
A week-by-week 90-day roadmap from programming basics to your first deployed AI project โ Python, ML fundamentals, LLMs, RAG, and a portfolio you can defend.