The important word is not patterns. It is useful. A dataset contains countless regularities. A machine-learning system needs a defined task and a way to judge which regularities help with that task.
The basic idea
Imagine building a spam filter.
With ordinary rule-based programming, you might write instructions such as "mark a message as spam if it contains this phrase and has more than three links." Spammers change their wording, legitimate messages sometimes match the rules, and the rule list becomes hard to maintain.
With machine learning, you provide reviewed examples of spam and legitimate email. You also choose a kind of model and a score for judging its mistakes. A learning algorithm then adjusts the model so that its outputs better match the reviewed examples.
The result is still software. The difference is where some of its behavior comes from. A programmer writes the learning procedure and its boundaries; training determines many of the settings inside those boundaries.
This is why the familiar phrase "without being explicitly programmed" can mislead. The system is programmed, but its complete decision rule is not written out case by case.
What learning means
A useful way to recognize a machine-learning problem is to identify four ingredients:
- A task. What should the system do? Examples include classify an email, estimate a delivery time, group similar customers, or choose an action.
- Experience. What information can it learn from? This might be labeled examples, unlabeled observations, past interactions, or rewards from trial and error.
- A measure of success. What makes one result better than another? It might be prediction error, the quality of a grouping, or accumulated reward.
- A model with adjustable parts. What range of possible rules can the learning process search?
Learning happens when experience changes those adjustable parts in a way that improves the chosen measure. The trained result is called a model. Using that model on a new case is separate from learning it.
That separation matters. Most deployed models do not automatically learn from each new request. Their learned settings stay fixed until someone runs another training or updating process.
How machine learning works
The details vary, but a typical project follows this loop:
- Define the task and the real-world outcome that matters.
- Collect and prepare examples that represent the conditions in which the model will be used.
- Choose how inputs will be represented and what forms of model are allowed.
- Define an objective: a numerical way to score candidate models.
- Run a learning algorithm that searches for settings with a better objective score.
- Use separate data to make choices and an untouched test set to estimate performance on new cases.
- Deploy the trained model, monitor its behavior, and retrain or replace it when the data or requirements change.
Here is the flow:
historical examples + a success measure
|
v
learning algorithm
adjusts model settings
|
v
trained model <----- held-out examples test generalization
|
new input
|
v
prediction, decision, or outputThe learning algorithm and the trained model are not the same thing. The algorithm is the fitting process. The model is the fitted result that handles new inputs.
For many supervised models, fitting is repeated correction. The model makes predictions on training examples. A loss function turns its errors into a number. An optimization method changes the model's settings to reduce that loss. Repeating this can improve training performance.
Lower training loss is not the final goal. A model can memorize details of its training examples and fail on new ones. This is overfitting. Machine learning succeeds when the model generalizes: it performs well on new, relevant cases drawn from the conditions it is meant to handle.
That is why evaluation data must be kept out of training. If test examples influence feature selection, preprocessing, or repeated model choices, information has leaked across the boundary. The resulting score can look better than the model's real performance.
Worked example: a spam filter
Suppose you have 1,000 emails that people have reviewed: 500 spam and 500 legitimate.
You set aside 200 emails before making modeling decisions. Those are the test set. The remaining 800 are training material. For each message, the system can represent signals such as the words it contains, the number of links, and whether the sender has appeared before.
At first, the model's adjustable settings are not useful. During training, the learner predicts a label for each training example, measures the errors, and changes the settings. A phrase associated with many spam messages might gain influence. A known sender might push the score toward legitimate mail. These are learned associations, not universal rules.
After training and model selection, you evaluate the final model once on the 200 untouched messages. Imagine it gets these results:
- 90 spam messages correctly blocked
- 94 legitimate messages correctly allowed
- 10 spam messages missed
- 6 legitimate messages incorrectly blocked
It classified 184 of 200 messages correctly, so its accuracy on this illustrative test is 92%.
That number does not finish the analysis. Blocking six legitimate emails may be more costly than missing ten spam messages. You might change the decision threshold to block fewer legitimate messages, accepting more missed spam. The right tradeoff comes from the task, not from the data alone.
Now a new email arrives and receives a spam score of 0.82. Producing that score is use of the trained model. The model does not necessarily learn from the email. If people later review new messages, those reviews may become experience for a future training run.
The 92% result is also conditional. It estimates future performance only if the test set is large enough and resembles future email. A shift in language, senders, or attacks can make yesterday's model less useful.
Main ways models receive a learning signal
Machine-learning categories overlap, but three broad learning setups are useful:
- Supervised learning uses examples paired with desired answers, such as emails labeled spam or legitimate.
- Unsupervised learning has no supplied answer for each example and instead optimizes an objective that exposes structure, such as grouping similar items.
- Reinforcement learning uses rewards or penalties from actions taken in an environment, often where one action affects what happens next.
Other labels describe mixtures or different dimensions. Semi-supervised learning combines labeled and unlabeled examples. Self-supervised learning constructs training targets from the data itself. Generative models learn to produce new samples, but they can be trained with more than one learning setup.
The categories are tools for describing a system, not a strict partition that every source uses in the same way.
Why machine learning matters
Machine learning is useful when the desired behavior is easier to demonstrate or measure than to express as a complete set of rules.
You can label examples of speech more easily than you can write every rule connecting sound waves to words. You can record travel times more easily than you can hand-code every interaction among traffic, weather, roadworks, and time of day. You can collect examples of fraudulent and legitimate transactions even when no short checklist cleanly separates them.
Learning does not remove human work. It changes the work. People decide what to predict, whose data is represented, which errors matter, and whether the output is safe enough to use. They also maintain the surrounding software and monitor what happens after deployment.
Machine learning is a poor fit when ordinary rules are clear, stable, and easy to verify. A tax calculation with explicit legal rules should not become a statistical guess merely because machine learning is available.
Common misconceptions
A model learns like a person
"Learning" describes measurable change from experience. It does not imply awareness, understanding, or a human learning process. A model may become more accurate at one narrow task without knowing what its inputs mean.
The data teaches the model everything
Data alone does not choose the task, objective, representation, or acceptable errors. Every learning system contains assumptions about which patterns it can find and prefer. Those choices shape the result.
Good training performance means the model works
A model can memorize its training material. Performance on properly separated, representative data is a better test of whether it learned something reusable.
More data always fixes the problem
More relevant, well-measured data can help. More duplicated, biased, mislabeled, outdated, or irrelevant data can reinforce the wrong behavior. Coverage and quality matter along with quantity.
Predictions explain causes
A model may discover that two signals move together and use one to predict the other. That does not show that changing one will cause the other to change. Causal claims usually need stronger assumptions or controlled experiments.
AI and machine learning are interchangeable
Machine learning is a major way to build AI systems, but rules, search, planning, and other techniques can also produce behavior described as AI. A modern product may combine learned models with substantial non-learning software.
How machine learning fits into an AI system
Machine learning is the process that produces or updates a learned model. The model is one component. An application adds data collection, interfaces, business rules, safety checks, storage, and monitoring around it.
A neural network is one possible model design, not another name for machine learning. Training is the stage in which a learning process fits a model. Inference is the stage in which the trained model handles new inputs. Keeping these pieces separate makes product claims easier to evaluate.
Where to go next
Read What Is a Neural Network? to see one widely used kind of machine-learning model. Then read What Is Training in AI? for the fitting process and What Is Inference in AI? for what happens when a trained model is used.