Machine learning (ML) is a branch of artificial intelligence in which a program learns to perform a task from data and experience rather than from rules a human writes by hand. The system improves its performance as it sees more examples, discovering patterns it was never explicitly programmed to follow.
What is machine learning?
Machine learning (ML) is a branch of artificial intelligence in which a program learns to do a task by finding patterns in data, instead of following step-by-step rules that a programmer wrote out in advance. You give the system examples, it adjusts internal numbers called parameters until its outputs match those examples well, and it then applies what it learned to data it has never seen.
The term goes back to Arthur Samuel, an IBM researcher who built a checkers-playing program and, in a 1959 paper in the IBM Journal of Research and Development, described machine learning as giving computers the ability to learn without being explicitly programmed. A more precise definition came from Tom Mitchell in his 1997 textbook: a program learns from experience E with respect to a task T and a performance measure P if its performance at T, as measured by P, improves with E. That sentence is worth keeping in mind, because every ML system is really just a choice of task, a measure of how well it does the task, and a source of experience to learn from.
- Task (T): what you want the system to do, such as classify an email or predict a price.
- Performance measure (P): how you score the output, such as accuracy or error.
- Experience (E): the data the system learns from.
- Learning means P improves on T as the system sees more E.
Machine learning vs. traditional programming
The core difference is what you write and what the machine produces. In traditional programming, a developer writes explicit rules (the logic), feeds in data, and the computer produces answers. In machine learning, you feed in data and the answers you want, and the computer produces the rules. ML flips the relationship: instead of coding the logic by hand, you let an algorithm infer the logic from labeled examples.
This matters most for problems where nobody can write the rules cleanly. Detecting a cat in a photo, transcribing speech, or flagging fraudulent transactions are tasks where the rules are too numerous, too fuzzy, or too entangled to enumerate. A human cannot list every pixel pattern that makes a cat a cat. ML sidesteps this by learning the decision boundary from thousands of examples. The trade-off is that the learned rules are statistical and approximate: the model can be wrong, and it is only as good as the data it learned from.
- Traditional programming: rules + data produce answers (a human writes the rules).
- Machine learning: data + answers produce rules (the algorithm finds the rules).
- ML wins when rules are too complex or fuzzy to write by hand.
- ML output is probabilistic and inherits the biases and gaps of its training data.
How a model actually learns: training, parameters, and loss
A machine learning model learns by minimizing error on its training data. The model is a mathematical function with adjustable parameters (weights). During training, it makes a prediction, a loss function measures how far that prediction is from the correct answer, and an optimization algorithm nudges the parameters in the direction that reduces the loss. Repeat this over many examples and many passes, and the parameters settle into values that produce good predictions.
The workhorse optimizer is gradient descent. It computes the gradient of the loss with respect to each parameter (the direction of steepest increase in error) and steps the parameters in the opposite direction by a small amount controlled by the learning rate. In neural networks, the gradients are computed efficiently with backpropagation, which applies the chain rule from calculus backward through the network's layers. The goal is not to memorize the training set but to generalize: perform well on new, unseen data. A model that memorizes noise and fails on new data is overfitting, the central failure mode that careful evaluation is designed to catch.
- Parameters (weights): the numbers the model adjusts as it learns.
- Loss function: scores how wrong a prediction is.
- Gradient descent: steps parameters in the direction that lowers the loss.
- Backpropagation: efficiently computes those gradients in neural networks.
- Overfitting: memorizing training data instead of generalizing to new data.
The three main types of machine learning
Machine learning is usually split into three categories by the kind of experience the model learns from: supervised, unsupervised, and reinforcement learning. The split is about whether the data carries correct answers (labels), carries none, or arrives as feedback from an environment the model is acting in.
These categories are not airtight. Semi-supervised learning mixes a little labeled data with a lot of unlabeled data, and self-supervised learning (the engine behind modern large language models) creates labels automatically from raw data, such as predicting the next word in a sentence. But supervised, unsupervised, and reinforcement learning remain the standard mental map, and almost every applied system is a variation on one of them.
- Supervised: learn from labeled examples (input paired with correct output).
- Unsupervised: find structure in unlabeled data, with no correct answers given.
- Reinforcement: learn by acting and receiving rewards or penalties.
- Self-supervised is a special case where labels are generated from the data itself.
Supervised learning
Supervised learning trains a model on labeled examples, where each input comes paired with the correct output. The model learns to map inputs to outputs so it can predict the label for new inputs. This is the most common form of ML in production because the objective is clear and progress is easy to measure against the known labels.
Supervised tasks divide into classification (predicting a discrete category, such as spam or not-spam) and regression (predicting a continuous number, such as a house price). Common algorithms include linear and logistic regression, decision trees, random forests, gradient-boosted trees, support vector machines, and neural networks. The main cost is the labels: someone has to produce the correct answers, and the model's ceiling is set by how accurate and representative those labels are.
- Needs labeled data: every training example has a known correct answer.
- Classification predicts categories; regression predicts numbers.
- Algorithms: logistic regression, decision trees, gradient boosting, neural networks.
- Bottleneck: producing accurate, representative labels at scale.
Unsupervised and reinforcement learning
Unsupervised learning finds structure in data that has no labels. Because there is no correct answer to copy, the model groups, compresses, or re-describes the data based on patterns it discovers. Clustering algorithms like k-means group similar points together; dimensionality-reduction methods like PCA compress many features into a few; and the embeddings that power semantic search learn to place similar items near each other in a vector space. Unsupervised methods are useful for exploration, anomaly detection, and turning raw data into representations other models can use.
Reinforcement learning (RL) takes a different shape entirely. An agent interacts with an environment, takes actions, and receives rewards or penalties, and it learns a policy (a strategy for choosing actions) that maximizes cumulative reward over time. There are no labeled examples, only consequences. RL is how systems learned to play Go and Atari at superhuman levels, and a variant called reinforcement learning from human feedback (RLHF) is used to align large language models with human preferences after pretraining.
- Unsupervised: clustering (k-means), dimensionality reduction (PCA), learned embeddings.
- Used for exploration, anomaly detection, and building useful representations.
- Reinforcement: an agent learns a policy by maximizing reward from an environment.
- RLHF applies reinforcement learning to align language models with human preferences.
Machine learning vs. deep learning vs. AI
These three terms nest inside each other, and confusing them is the most common mistake newcomers make. Artificial intelligence is the broadest field: any technique that makes machines behave intelligently, including rule-based systems that involve no learning at all. Machine learning is the subset of AI where systems learn from data. Deep learning is a subset of machine learning that uses neural networks with many layers.
Deep learning earns its own name because depth changes what is possible. Classical ML often relies on humans to design the input features by hand, then learns a model on top of those features. Deep learning learns the features and the model together, directly from raw data such as pixels, audio, or text, by stacking layers that each build more abstract representations than the last. This is why deep learning dominates perception and language tasks, and why every large language model is a deep learning system. The cost is that deep models need far more data and compute, and they are harder to interpret than a small decision tree.
- AI: the whole field, including systems that do not learn at all.
- ML: the part of AI that learns from data.
- Deep learning: the part of ML that uses many-layered neural networks.
- Deep learning learns features automatically; classical ML often needs hand-designed features.
- Relationship: deep learning is inside machine learning, which is inside artificial intelligence.
A minimal example and where ML connects to memory
Here is what supervised learning looks like in a few lines of practical code, using scikit-learn. The point is the shape: split data, fit a model on training data, and score it on held-out data the model never saw during training. That held-out split is how you check for generalization instead of memorization.
Machine learning is also the foundation underneath the AI memory tools many people now use. The models that read your documents, embed your notes into vectors, and retrieve the right snippet when you ask a question are all ML systems. When MemX turns a screenshot into searchable text and finds the relevant memory later, it is running learned models for optical character recognition, embeddings, and semantic search rather than hand-written rules. Understanding ML is the entry point to understanding how the entire modern AI stack, from language models to retrieval, actually works.
- Always evaluate on data the model did not train on, or you cannot trust the score.
- Embeddings, retrieval, OCR, and language models are all machine learning under the hood.
- AI memory products are applied ML: learned models, not hand-coded rules.
Key takeaways
- Machine learning is the branch of AI where a program learns a task from data and experience instead of following rules written by hand.
- The defining contrast with traditional programming: you supply data and answers, and the algorithm produces the rules, rather than the other way around.
- Models learn by minimizing a loss function with gradient descent, adjusting parameters to predict well on new data while avoiding overfitting.
- The three main types are supervised (labeled data), unsupervised (unlabeled data), and reinforcement learning (reward from an environment).
- Deep learning is a subset of machine learning that uses many-layered neural networks, and machine learning is itself a subset of artificial intelligence.
Frequently asked questions
Related terms
Related reading
Sources
- Arthur Samuel, Some Studies in Machine Learning Using the Game of Checkers (IBM Journal of Research and Development, 1959)
- Tom Mitchell, Machine Learning (1997) textbook page
- What is Machine Learning? (IBM)
- scikit-learn: Getting Started (official documentation)
- Google Machine Learning Crash Course: Types of ML Systems
Put the idea into practice
MemX is an AI memory agent built on these ideas: store anything, skip the folders, and find it again by asking in plain English.
Try MemX Free