Skip to content

What Is Machine Learning? A Beginner’s Guide with a Worked Example

Guides
Blue and amber sample blocks sit in a tray beside an optical testing station.
Machine learning is a way to build software that learns patterns from examples. During training, an algorithm adjusts a model using data. Later, the model applies what it learned to new inputs, a step called inference. A routing model might learn from old help requests and predict which team should receive a new one. A separate test shows whether that pattern holds up.

What a model actually learns

In supervised learning, the training examples include answers called labels. A help desk ticket might provide the subject and message as inputs, with the correct team as its label. Predicting a category is classification. Predicting a number, such as delivery time, is regression.
Unsupervised learning looks for structure in data without a known answer for each example. A library could use clustering to explore common borrowing patterns. In reinforcement learning, a system learns a policy by taking actions and receiving feedback in the form of rewards. Each approach answers a different kind of question. Google’s introduction to machine learning

How training, validation and testing fit together

  • Training data fits the model. It is where the model learns the relationships between inputs and outcomes.
  • Validation data helps you choose between candidate models or adjust settings, such as the confidence needed before routing a ticket automatically.
  • Test data estimates how the chosen model performs on separate examples. Reserve it until decisions about the model and settings are made.
The order matters. A model can overfit, picking up quirks that work on its training examples but carry little value on new ones. Repeatedly tuning against the final test can hide the same problem. It turns the supposed final exam into part of the study material. Google’s guide to data splits and overfitting

Worked example with 100 help desk tickets

Imagine a small team testing a model on 100 new tickets. Eighty should go to general support and 20 to technical support. A simple baseline sends every ticket to general support. It scores 80% accuracy and catches zero technical tickets.
Suppose a trained model correctly routes 75 general tickets and 15 technical tickets. Accuracy rises to 90%. The model catches 15 out of 20 technical tickets, giving it 75% recall for that category. It also sends five general requests to the technical queue. The team can now weigh two costs separately, missed technical problems and extra work for specialists.
For a fair test, the team uses earlier tickets for development and later ones for the final test. It keeps replies from the same ticket thread together and removes fields added after routing. A queue ID assigned by a support worker would give away the very decision the model is supposed to predict. This is one form of data leakage. Scikit-learn’s guide to data leakage

Questions to ask about a machine learning result

  • What decision is the model supposed to support, and what information will be available at that moment?
  • What simple rule or current process provides a meaningful baseline?
  • How were test examples kept independent, and do they resemble the cases the model will see later?
  • Which errors matter most? Ask for results on those cases as well as an average.
  • Who reviews low-confidence predictions and checks for changes after deployment?
For an example of how a trained model becomes one part of an application with tools and review, see AI agent architecture. Follow our machine learning coverage for research and applications.
loading

Loading