AI Development · Level 0 · Start here

How Machine Learning Works: Classification, Neural Networks, RNNs and YOLO

Machine learning basics for AI builders: learning from examples, classification, neural networks, RNNs, YOLO and TensorFlow, and when you need them at all.

By 7 min read
Machine learning basics for AI builders: learning from examples, classification, neural networks, RNNs, YOLO and TensorFlow, and when you need them at all.

Most parts of this learning path use finished models: you send text to a large language model (LLM) and get an answer back. Behind every one of these models sits machine learning, and the same ideas power spam filters, product recommendations and the camera in a self-checkout. Sooner or later you will read terms like classification, neural network, RNN or YOLO in a job ad, a tutorial or a product description.

This is part 6, the last part of Level 0 in our AI Development learning path. You will learn how a model learns from examples, what classification means, how a neural network works in plain words, which four model families you will meet, what frameworks such as TensorFlow are for, and when you need any of this instead of an LLM API. You do not need math or code for this part.

Learning from examples instead of rules

Classic software follows rules that a person wrote: “if the email contains the word lottery, move it to spam”. Machine learning turns this around. You give the computer many examples with the right answer, and it finds the rules itself. The result is a model: a program with millions of adjustable numbers, called weights, that turns an input into an output.

Learning happens in a loop. The model makes a prediction for an example, a formula measures how far off it was, and the weights change a little so that the next prediction is better. After many rounds over thousands of examples, the errors become small. This is training. Using the finished model on new data is called inference, and that is what you pay for when you call an LLM API.

A loop of four steps around a model: examples with the right answer, prediction, measure the error and adjust the weights; below a note to test the model on new data afterwards
Training in one picture: predict, measure the error, adjust, and repeat.

There are three main ways to learn:

  • Supervised learning: every example has the right answer, called a label. “This email is spam, this one is not.” Most business uses work this way.
  • Unsupervised learning: the examples have no labels. The model finds groups or patterns on its own, for example customers who buy in a similar way.
  • Reinforcement learning: the model tries actions and gets a reward or a penalty, like a game score. LLMs are fine-tuned partly this way, with human feedback on their answers.

Classification: the task you will meet most

Classification means putting an input into one of several fixed groups, called classes. Is this email spam or not? Which department should get this support ticket? Is this transaction fraud? Machine learning classification is the most common task in business, because so many decisions are a choice between a few options.

A classification model does not just pick a class. It gives a probability for each class, for example “spam: 0.93”. You decide where the line is. A low line catches more spam but also blocks more real emails; a high line lets more spam through. To judge a classifier, look at more than one number:

How Machine Learning Works: Classification, Neural Networks, RNNs and YOLO
TaskWhat the model outputsExample
ClassificationOne class out of severalSpam or not spam; ticket goes to billing, technical or sales
RegressionA numberThe price of a used car; next week’s sales
ClusteringGroups that nobody defined beforehandCustomer segments with similar buying habits
Object detectionObjects in an image with a box around eachProducts on a shelf photo, people in a camera image
GenerationNew text, images or audioAn answer to a question, a product photo, a voiceover
  • Accuracy is the share of all predictions that were right. It can mislead: if only 1% of transactions are fraud, a model that always says “no fraud” is 99% accurate and useless.
  • Precision asks: of all emails the model marked as spam, how many really were spam?
  • Recall asks: of all real spam emails, how many did the model catch?

Neural networks in plain words

A neural network is a model built from many small units, loosely inspired by brain cells. Each unit takes numbers in, multiplies them by its weights, adds them up and passes the result on. The units sit in layers: an input layer that receives the data, hidden layers in the middle and an output layer with the answer. A network with many hidden layers is called deep, which is where the term deep learning comes from.

What makes neural networks powerful is that the early layers learn simple patterns and the later layers combine them. In an image model, the first layers react to edges and colors, the middle layers to shapes such as wheels or eyes, and the last layers to whole objects. Nobody programs these steps; they come out of training.

Four model families you will meet

Neural networks come in different designs, and each fits a different kind of data. Classic models without neural networks are still the best choice for many tables.

Four cards: classic models for tables, CNNs and YOLO for images, RNNs for sequences and Transformers for text and large language models
Which family fits depends on the data, not on the hype.

  • Classic models such as decision trees and logistic regression work on tables with rows and columns: customer data, transactions, sensor values. They train fast, need little data and are easy to explain.
  • Convolutional neural networks (CNNs) look at images through small windows that slide across the picture. YOLO (“You Only Look Once”) is a well-known family of object detection models built on this idea: it finds all objects in an image in a single pass and draws a box around each one, fast enough for live video (Source: Redmon et al., “You Only Look Once”, CVPR 2016, arxiv.org).
  • Recurrent neural networks (RNNs) read a sequence one step at a time and carry a memory from step to step, which suits speech, sensor data and text. An improved version called LSTM remembers longer stretches (Source: Hochreiter and Schmidhuber, “Long Short-Term Memory”, Neural Computation 1997).
  • Transformers look at all parts of a text at once and learn which words relate to which. They replaced RNNs for most language tasks after 2017 (Source: Vaswani et al., “Attention Is All You Need”, NeurIPS 2017, arxiv.org). Almost every large language model is built on them. Our LLM database lists 343 language models with their benchmark results.

Frameworks: TensorFlow, PyTorch and the rest

Nobody writes the math of a neural network by hand. Frameworks do it for you: you describe the layers, and the framework handles training on graphics cards (GPUs). TensorFlow from Google and PyTorch, which started at Meta, are the two big ones; PyTorch dominates research, and both run in production. For classic models on tables, scikit-learn is the usual choice in Python.

A typical first TensorFlow tutorial trains a small network to recognize handwritten digits from the MNIST data set, in a few dozen lines of code. That is a good exercise to see the training loop from this part in action. Cloud platforms such as Amazon SageMaker, Google Vertex AI or Azure Machine Learning run the same frameworks on rented hardware, so you can start machine learning on AWS or another cloud without buying GPUs. Renting compute is covered in GPU infrastructure for AI in Level 3.

When you need this, and when an LLM API is enough

For most AI features in apps today, you do not train a model at all. You call an LLM through an API, as you will in your first LLM API call in Level 1. Training your own model pays off when you have many labeled examples, a narrow task that repeats millions of times, or data that must not leave your servers.

How Machine Learning Works: Classification, Neural Networks, RNNs and YOLO (2)
Your taskUsually the better choiceWhy
Sort support tickets into five departmentsAn LLM with clear instructions, later a small classifierFast to start; a trained classifier is cheaper at high volume
Spot fraud in payment dataA classic model on the tableNeeds speed, explanations and works on numbers, not text
Count products on shelf photosAn object detection model such as YOLOFinds and locates many objects per image, in real time
Answer questions about your documentsAn LLM with retrieval (RAG)Uses your texts without any training
Predict machine failures from sensor dataA classic model or a sequence modelWorks on time series; LLMs are not built for that

If you do decide to adapt a model, start with the decision guide fine-tuning vs. RAG vs. prompting in Level 3. It helps you choose the cheapest way that works before you collect a single training example.