What Is Machine Learning

Imagine writing a program to recognize handwritten digits on checks. You could try to hand-code rules: "if the shape has one loop and a straight line, call it a 9." Within days you will drown in exceptions. Sloppy loops, disconnected strokes, and regional handwriting quirks pile up. The rulebook never converges. This is the wall that explicit programming hits. It happens whenever the mapping from input to output is too complex, too variable, or simply unknown to us in closed form. Machine learning is the discipline that replaces hand-written rules with rules inferred from data. Instead of a programmer specifying the logic, an algorithm examines examples. These include images paired with labels, sequences of sensor readings, and records of past decisions and their outcomes. From these, it constructs its own internal procedure. This procedure produces outputs on new, unseen inputs. This shift is from programming behavior to programming the capacity to learn behavior. It is arguably the central methodological idea of modern computing's most visible frontier. The importance is not abstract. Search engines rank pages using learned relevance models. Voice assistants transcribe speech using learned acoustic and language models. Banks flag fraudulent transactions using learned anomaly detectors. Self-driving cars perceive lanes and pedestrians using learned vision systems. In every one of these systems, no engineer explicitly wrote out the millions of conditional rules that would be needed. Instead, the rules were discovered from data by an optimization procedure. This article lays the conceptual foundation. It gives a precise, textbook-standard definition of learning. It carefully contrasts learning with explicit programming. It introduces the vocabulary — task, experience, performance measure, generalization. Every subsequent topic in the field builds on this vocabulary. It deliberately stops short of the specific learning paradigms (supervised, unsupervised, reinforcement). It also stops short of the formal mathematical learning-theory apparatus. These are natural next steps built on top of what is established here.

Key takeaways
  • Machine learning builds programs that improve their performance on a task through experience, rather than through manually written rules.
  • Tom Mitchell's formal definition anchors the field: a program learns from experience E with respect to task T and performance measure P if P improves with E.
  • Traditional programming maps rules + input → output; machine learning maps input + output examples → rules.
  • The core goal is generalization: performing well on new, unseen data, not just memorizing the training data.
  • Learning requires a hypothesis space, an objective function to optimize, and an algorithm to search that space.
  • This foundation leads directly into the major learning paradigms — supervised, unsupervised, reinforcement — covered next.
The core insight

Machine learning is the automated construction of a decision-making procedure from data, rather than from explicit human-written instructions.

The idea

Classical computer programs are built from an explicit algorithm: a finite, precise sequence of instructions that a programmer designs by reasoning directly about the problem. Given an input, the program applies these fixed instructions and produces an output. The correctness of the program depends entirely on whether the programmer's understanding of the problem was complete and correctly encoded. Machine learning inverts this relationship. Rather than supplying the instructions, we supply experience — a dataset of examples relevant to the problem — and a learning algorithm searches over a large space of candidate instructions (called models or hypotheses) to find one that performs well on that experience, in the hope that it will also perform well on new data drawn from the same underlying process. The canonical formal statement of this, due to Tom Mitchell, is: > A computer program is said to learn from experience EE with respect to some class of tasks TT and performance measure PP, if its performance at tasks in TT, as measured by PP, improves with experience EE. Each of the three components deserves precision. The task TT is what the system is ultimately asked to do — classify an email as spam, predict a house price, choose a move in a game. The experience EE is the data or interaction history available to the learner — a labeled dataset, a stream of unlabeled observations, or a sequence of trial-and-error interactions with an environment. The performance measure PP is a quantitative criterion — accuracy, mean squared error, cumulative reward — used to evaluate how well the task is being performed, and it is this measure that must improve as more experience is incorporated for the system to qualify as "learning" in this technical sense. Underlying every learning system are a few structural ingredients that recur throughout the field. A hypothesis space H\mathcal{H} is the set of candidate functions the learner is allowed to choose from — linear functions, decision trees, neural networks of a given architecture, and so on. A loss function quantifies the disagreement between a hypothesis's prediction and the truth on a single example. An objective (often the average loss over the training data, sometimes with a regularization term) is the quantity the learning algorithm actually optimizes. Finally, generalization is the property of interest: performing well not on the training data itself, but on new data drawn from the same distribution, which is measured through held-out validation or test data. This distinction between fitting the data at hand and generalizing beyond it is the deepest conceptual dividing line in the whole field, and it foreshadows concepts like Bias-Variance Tradeoff and Overfitting that recur in every learning paradigm.

How it works

Although specific algorithms differ enormously, essentially every machine learning system follows the same high-level procedure. It is useful to walk through this procedure once, abstractly, before specializing into supervised, unsupervised, or reinforcement settings.

Step 1 — Define the task and collect experience. Decide precisely what output is wanted (a label, a number, an action) and gather data that exemplifies the relationship between inputs and desired outputs, or simply exemplifies the structure of the input distribution if no explicit outputs are available.

Step 2 — Choose a representation and hypothesis space. Decide how inputs will be represented as vectors of features, and choose the family of functions (linear model, tree, neural network) the learner will search over. This choice encodes assumptions — an Inductive Bias — about what kinds of patterns are plausible.

Step 3 — Choose a performance measure and turn it into an objective. Translate "do well at the task" into a concrete numerical loss that can be computed on any candidate hypothesis and any example.

Step 4 — Fit the model by optimization. Use an algorithm — often a variant of Gradient Descent, or an exact combinatorial procedure for simpler models — to search the hypothesis space for a function that minimizes the objective on the training experience.

Step 5 — Evaluate generalization. Measure the performance measure on data the learner did not use for fitting, to estimate how it will behave on truly new inputs. If performance is poor, revisit the representation, hypothesis space, or amount of data, and repeat. ``` ALGORITHM GeneralLearningLoop Input: Task T, Experience E, Performance measure P, Hypothesis space H, Learning algorithm L Output: A fitted model h* that performs well on T according to P 1. (D_train, D_valid, D_test) := SPLIT(E) # partition experience 2. best_h := NULL 3. best_score := -INFINITY 4. for each candidate configuration c in H's configuration space: 5. h_c := L(D_train, c) # fit a hypothesis given config c 6. score := EVALUATE(h_c, D_valid, P) # generalization estimate 7. if score > best_score: 8. best_score := score 9. best_h := h_c 10. final_score := EVALUATE(best_h, D_test, P) # unbiased final estimate 11. return best_h, final_score ``` Two details make this pseudocode more than a toy sketch. First, the data is deliberately split into three disjoint pieces: `D_train` to fit parameters, `D_valid` to choose among hypotheses or hyperparameters, and `D_test`, touched exactly once, to report an honest final estimate of performance. Reusing `D_test` for model selection would leak information and bias the reported score upward — a mistake detailed in the pitfalls table below. Second, `L` itself (line 5) is a placeholder for an entire family of concrete algorithms — closed-form least squares, gradient descent on a neural network's weights, greedy tree splitting — each of which is the subject of its own dedicated treatment; this article's job is only to establish the shape of the loop they all live inside.

Figure
Explicit programming versus machine learning: where the "rules" come from
Traditional Programming Rules Input Data Computer Output Machine Learning Input Data Output (labels) Learning Algorithm Learned Rules

Complexity & correctness

Machine learning is not a single algorithm, so "complexity" here means the shape of the resource tradeoffs that recur across the field, plus the sense in which the general loop above is a sound procedure.

Time and space complexity. Fitting a hypothesis (line 5 of the pseudocode, `L(D_train, c)`) dominates cost. For nn training examples with dd features:

  • Closed-form linear regression via the normal equations costs O(nd2+d3)O(nd^2 + d^3) time (forming X⊤XX^\top X and inverting a d×dd \times d matrix) and O(d2)O(d^2) space, honest for small-to-moderate dd; it becomes impractical once dd is large, motivating iterative alternatives.
  • Gradient-descent-based fitting costs O(nd)O(nd) time per iteration (one pass over the data to compute a gradient) and O(d)O(d) space for parameters, times the number of iterations needed to converge — which itself depends on the conditioning of the objective and is not fixed a priori.
  • The outer hyperparameter search (the loop over configurations `c` in the pseudocode) multiplies whichever inner cost by the number of configurations tried, which is why model selection is often the dominant real-world cost, not any single fit.

Evaluating a fitted hypothesis on one new input, once fitting is done, is typically far cheaper than the training cost itself — often O(d)O(d) for linear models — which is precisely why the expensive learning step is done once offline and the cheap "inference" step is run repeatedly at deployment.

Correctness: what does it even mean for learning to be "correct"? Unlike sorting or shortest-path algorithms, a learning algorithm cannot be judged against a single deterministic correct output, because the true input-output relationship is unknown and only observed through noisy, finite samples. The right correctness criterion is statistical: does the learned hypothesis's expected performance on the true underlying distribution, not just on the observed training sample, approach the best achievable performance as the amount of data grows? This is the question addressed rigorously by The Formal Learning Problem and by learning theory more broadly, but the essential argument can be sketched now. Suppose the training data Dtrain={(xi,yi)}i=1nD_{\text{train}} = \{(x_i, y_i)\}_{i=1}^n is drawn i.i.d. from a fixed but unknown distribution D\mathcal{D}, and the learner selects h∈Hh \in \mathcal{H} minimizing the empirical loss

L^(h)=1n∑i=1nℓ(h(xi),yi).\hat{L}(h) = \frac{1}{n} \sum_{i=1}^n \ell(h(x_i), y_i).

By the law of large numbers, L^(h)\hat{L}(h) concentrates around the true expected loss L(h)=E(x,y)∼D[ℓ(h(x),y)]L(h) = \mathbb{E}_{(x,y)\sim \mathcal D}[\ell(h(x), y)] for any fixed hh, with fluctuations shrinking at rate O(1/n)O(1/\sqrt{n}). The subtlety is that the learner does not evaluate a single fixed hh — it searches over all of H\mathcal{H} and picks whichever hypothesis looks best on this particular sample, so the fluctuation must be controlled uniformly over the whole space, not just pointwise. This uniform control is exactly what tools such as VC dimension and Rademacher complexity supply, and it is what justifies the separate validation split in the pseudocode: choosing among hypotheses using data disjoint from the data used to fit them prevents the "look best on this sample by luck" failure mode from contaminating the final estimate.

Honest tradeoffs. More expressive hypothesis spaces H\mathcal{H} can fit the training data better (lower L^\hat{L}) but require more data to guarantee that low training loss implies low true loss — the Bias-Variance Tradeoff. There is no free lunch: no single hypothesis space or algorithm generalizes best across all possible tasks, so choosing H\mathcal{H} is itself an inductive assumption about the problem, not a purely mechanical decision. This is why "collecting more data" and "restricting the hypothesis space" are both, in different regimes, valid remedies for poor generalization, and why neither is universally correct.

Worked example

Consider a tiny, fully worked instance of the general loop: predicting a house's price from its size, using five historical sales as experience.

Size (m²), xxPrice ($1000s), yy
50150
70200
90260
110300
130370

Step 1 (task & experience). TT = predict price given size. EE = the five (x,y)(x,y) pairs above. PP = mean squared error (MSE) on new sales.

Step 2 (hypothesis space). Choose linear functions h(x)=w1x+w0h(x) = w_1 x + w_0 — a deliberately simple H\mathcal{H} for a five-point illustration.

Step 3 (objective). Minimize L^(w0,w1)=15∑i(w1xi+w0−yi)2\hat{L}(w_0, w_1) = \frac{1}{5}\sum_i (w_1 x_i + w_0 - y_i)^2, i.e. ordinary least squares.

Step 4 (fit). Using the standard least-squares formulas w1=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2w_1 = \dfrac{\sum (x_i - \bar x)(y_i - \bar y)}{\sum (x_i-\bar x)^2} and w0=yˉ−w1xˉw_0 = \bar y - w_1 \bar x, with xˉ=90\bar x = 90, yˉ=256\bar y = 256:

xi−xˉx_i - \bar xyi−yˉy_i - \bar yproduct(xi−xˉ)2(x_i-\bar x)^2
-40-10642401600
-20-561120400
0400
2044880400
4011445601600
Sum108004000
w1=108004000=2.7,w0=256−2.7×90=13w_1 = \frac{10800}{4000} = 2.7, \qquad w_0 = 256 - 2.7 \times 90 = 13

So the fitted hypothesis is h(x)=2.7x+13h(x) = 2.7x + 13.

Step 5 (evaluate generalization). Suppose a sixth sale, held out as `D_test` and never used in fitting, is x=100x=100, y=280y=280. The model predicts h(100)=2.7(100)+13=283h(100) = 2.7(100) + 13 = 283, giving a squared error of (283−280)2=9(283-280)^2 = 9 — a small error, suggesting the linear hypothesis generalizes reasonably beyond the five training points, though five points is far too little data to draw a strong statistical conclusion. This trace makes the contrast with explicit programming concrete: nobody told the system "price equals 2.7 times size plus 13." That rule was discovered by minimizing squared error over historical experience — the defining signature of machine learning, versus a programmer hand-deriving the same formula from domain reasoning (which, for house pricing, is exactly the kind of reasoning that becomes intractable once dozens of correlated features like location, age, and renovation history are added).

Common pitfalls & traps

PitfallWhy it happensConsequence
Evaluating on the training set onlyConfusing "fits the data" with "generalizes"Reported performance is optimistic; real-world performance is worse
Touching the test set during model selectionConvenience — reusing the same split repeatedlyInformation leaks from test to model choice; final score is biased
Choosing a hypothesis space too rich for the data availableBelieving "more flexible is always better"Overfitting: low training error, high error on new data
Choosing a hypothesis space too poorTrying to keep things "simple" or interpretable at all costsUnderfitting: high error even on training data
Assuming i.i.d. data when it is not (e.g. time series, duplicated records)The mathematical justification for generalization assumes independent, identically distributed samplesGeneralization guarantees silently fail; performance estimates are unreliable
Treating "machine learning" as a synonym for "neural networks"Media framing, recency biasMisses that linear regression, decision trees, and k-means are also machine learning

Pioneers & history

Machine learning's conceptual roots lie in the mid-twentieth-century convergence of statistics, cybernetics, and early artificial intelligence research, long before the computational power existed to make the ideas practical at scale.

Origins · 1 minArthur Samuel and how this was discovered
AS
Arthur Samuel
1901–1990 · Pioneer of self-improving programs and coiner of the term "machine learning"

Arthur Samuel built a checkers-playing program at IBM in the 1950s that improved its play by playing games against itself and updating its evaluation function based on outcomes — an early, working instance of a program that got better through experience rather than through additional hand-coded rules. In 1959 he coined the phrase "machine learning" to describe exactly this capacity, defining it informally as giving computers "the ability to learn without being explicitly programmed."

History
1950
— Alan Turing proposes the "learning machine" idea and the Turing Test in "Computing Machinery and Intelligence."
1957
— Frank Rosenblatt introduces the perceptron, an early trainable linear classifier inspired by neurons.
1959
— Arthur Samuel's checkers program demonstrates self-improvement through experience and coins "machine learning."
1997
— Tom Mitchell publishes the canonical task/experience/performance-measure definition used throughout this article.
2012
— Deep convolutional networks trained on large labeled datasets dramatically reduce image classification error, catalyzing the modern deep learning era.

Where this matters

Recommendation engines at streaming and e-commerce platforms learn user preference models from click and purchase history rather than from hand-tuned rules, updating continuously as new interactions arrive. Email providers learn spam filters from millions of labeled messages, adapting automatically as spammers change tactics — a task where writing an explicit, exhaustive rulebook is provably a losing game against an adversary who evolves. Medical imaging systems learn to flag tumors from datasets of annotated scans, often reaching or exceeding specialist-level accuracy on narrow, well-defined detection tasks. Financial institutions learn fraud-detection models from historical transaction patterns, since fraud tactics evolve faster than any static rule list could track by hand. Autonomous vehicles learn perception stacks — lane detection, object recognition, trajectory prediction — from enormous driving datasets, because the space of real-world driving scenes is far too vast and irregular for exhaustive manual rule design. In every one of these systems, the shift from explicit programming to learning from data is not a stylistic preference — it is the only tractable approach once the target relationship is too complex or too poorly understood to specify by hand, which is exactly the boundary this article was written to make precise.

Ask the tutor: How does the choice of hypothesis space concretely determine whether a model underfits or overfits a given dataset?

Is machine learning the same thing as artificial intelligence?

No. Artificial intelligence is the broader goal of building systems that behave intelligently, which historically included hand-coded expert systems and logic-based reasoning that involved no learning from data at all. Machine learning is one specific approach to achieving intelligent behavior: building the capacity to improve at a task through experience, rather than encoding all behavior by hand. Modern AI systems overwhelmingly rely on machine learning, especially deep learning, but the two terms are not interchangeable, and older AI systems (chess engines with hand-tuned evaluation functions, rule-based diagnostic systems) predate and sit outside machine learning proper.

Does machine learning always require a large dataset?

Not strictly, but generalization guarantees generally strengthen as data grows, because empirical performance estimates concentrate around true performance at a rate governed by sample size. Simple hypothesis spaces (like linear models with few features) can generalize acceptably from small datasets, as the worked house-price example illustrates. Highly flexible hypothesis spaces, such as deep neural networks with millions of parameters, typically need very large datasets to avoid overfitting, since they can otherwise memorize small training sets without learning a genuinely generalizable pattern.

What exactly is being "learned" when we say a model learns?

Concretely, learning means adjusting the internal parameters of a chosen hypothesis (weights in a linear model, split thresholds in a tree, weight matrices in a neural network) so that a loss function computed on training experience is minimized, or nearly minimized. Nothing about the code implementing the model changes — the algorithm's structure and the hypothesis space are fixed by the engineer beforehand. What changes is the specific configuration of parameters within that fixed structure, discovered through optimization rather than specified by hand.

Why can't we just write more detailed rules instead of using machine learning?

For some tasks we can, and traditional rule-based programming remains the right tool — for example, computing taxes from a known tax code, or validating a well-specified input format. Machine learning becomes necessary when the true input-output relationship is too complex, too high-dimensional, or too poorly understood to articulate as an explicit finite rule set, such as mapping pixel intensities to object identities. In such cases, attempting to hand-write rules leads to combinatorial explosion in the number of special cases, while a learning algorithm can discover a compact approximate rule directly from examples.

How does this relate to statistics — isn't this just curve fitting?

Machine learning shares deep mathematical roots with statistics, and many core techniques (linear regression, logistic regression, Bayesian inference) originated in statistics departments. The two fields differ somewhat in emphasis: statistics has traditionally emphasized inference, uncertainty quantification, and interpretability of a small number of parameters, while machine learning has emphasized predictive accuracy on new data, often using very high-capacity models with many parameters and correspondingly large datasets. In practice the boundary is blurry, and the mathematical foundations — optimization, probability, linear algebra — are shared throughout.

What comes after understanding this definition of learning?

The natural next step is distinguishing the major learning paradigms based on what kind of experience is available: Supervised Learning uses labeled input-output pairs, Unsupervised Learning uses only inputs and seeks structure within them, and Reinforcement Learning uses trial-and-error interaction with an environment plus reward signals rather than direct labels. Beyond that, The Formal Learning Problem develops the precise mathematical machinery — hypothesis spaces, sample complexity, generalization bounds — that turns the intuitive picture given here into provable statements about when and why learning succeeds.

Can a system be "learning" without using any statistics or optimization?

Under Mitchell's definition, what matters is that performance measurably improves with experience, not the specific mechanism used to achieve that improvement. In practice, essentially every widely used machine learning method achieves this improvement through some form of optimization over a quantitative objective, because optimization gives a principled, checkable way to guarantee performance moves in the right direction. Purely symbolic or rule-adjustment systems that improve through experience without explicit statistical objectives exist historically (some early expert systems with rule-refinement) but are a small minority of modern practice.

Where this leads