Machine learning develops algorithms that use data or experience to improve performance on a specified task. The task, the experience available to the algorithm and the performance criterion must all be stated. A statistical classification system might learn from labelled training data; an unsupervised learning method instead looks for structure without those labels.[ref]
For example, a linear regression model can learn coefficients predicting a numerical outcome from measured inputs. Minimizing its error on the training data determines a fitted model, but does not establish how well it predicts new observations. A separate test set estimates performance on data withheld from fitting. Overfitting occurs when fitting peculiarities of the training data impairs this generalization; data leakage can make the evaluation misleading.[ref]
Statistical learning supplies tools for reasoning about these prediction and uncertainty questions. A useful learned model is therefore assessed through an explicit task and evaluation, alongside the running time and other resources needed to train and use it.
A generative model describes how observations can be produced. It can specify a probability distribution explicitly, or provide a procedure that generates samples whose distribution is determined by parameters . Producing observations and assigning a tractable numerical probability to every observation are separate capabilities.
An original two-bit example defines a joint probability distribution through conditional probabilities. Let
Generate first, then generate using the applicable conditional probability. The four possible outputs have probabilities
which sum to one. The procedure generates both complete observations and a dependence between their components. Always outputting the most probable observation, 11, would produce a different distribution: it would discard all the other outcomes rather than sample the stipulated model.
A generative adversarial network gives a different implementation. A generator transforms an input random variable into a candidate observation, while a discriminator supplies a training signal by distinguishing generated samples from training examples. The original paper develops this as an adversarial learning procedure.[ref]
The model's samples must be assessed against the intended distribution or task. A visually plausible observation alone does not establish that the model represents the full range of observations well; distributional coverage and the probability of different outcomes matter alongside individual sample appearance.
PyTorch is a software framework for numerical tensor operations and machine learning, including automatic differentiation and tools for training neural networks. Its array operations provide the calculations; its differentiation machinery records how a result depends on selected inputs. A computed gradient is distinct from the later optimization step that uses it.[ref]
For example, this small Python calculation differentiates at :
import torch
x = torch.tensor(2.0, requires_grad=True)
y = x * x + 3 * x
y.backward()
print(x.grad)  # tensor(7.)
The result agrees with . The call to backward() computes and accumulates derivatives; it does not itself change x to minimize y. In a training loop, parameter updates and clearing old gradients are separate operations.[ref]
A useful consequence of its dynamically constructed computation is that executed control flow determines the recorded graph. Recording a new graph on the next execution makes it possible to differentiate the computation that actually ran. Disabling gradient tracking or detaching a value changes that connection and must be deliberate.[ref]
A feature is an input attribute or computed representation used by a machine learning system. An example can be represented by a vector whose coordinates are individual feature values; a design matrix commonly places examples in rows and these coordinates in columns. A feature can be measured directly or derived from other measurements.[ref]
For example, classifying manufactured parts might use measured length and width as two feature inputs. Their ratio is another possible feature, exposing a shape relationship to a simple model. Choosing a representation changes which rules are easy to learn. A variable available only after the desired prediction time can introduce data leakage, while a distributed representation can learn useful coordinates without assigning each one a human-readable meaning.
A distributed representation encodes an object through a pattern across several components, with each component reusable across many objects. In contrast to allocating a separate indicator to every object, shared components let related objects share information. For example, three binary attributes can encode eight combinations even though there are only three coordinates.
In machine learning, the coordinates are often learned real-valued features rather than named attributes. A word embedding can encode several aspects of word usage in one vector; no single coordinate needs to have a simple human interpretation. Combinatorial capacity alone does not guarantee useful learning: the training objective must make the representation's geometry relevant to the task.[ref]
Representation learning learns a transformation of observations into features that make a subsequent task easier. Writing and a prediction as separates the learned representation from the predictor; training may optimize both together. The objective can come from supervised learning or unsupervised learning.
For example, a neural network trained to classify images can learn edge-like and shape-sensitive features instead of receiving a fixed list of hand-measured quantities. The representation can sometimes be reused on a second task with fewer labeled examples. Such transfer is a hypothesis to evaluate: information useful for the original task can omit a distinction essential to the next. A distributed representation describes how information is encoded; representation learning describes how the encoding is obtained.[ref]
A neural language model uses a neural network to assign a probability distribution to language sequences. An autoregressive model factorizes the probability of words as
Training by maximum likelihood estimation rewards the observed next words; generation repeatedly samples from the conditional distribution. If a two-word sequence has first-word probability and conditional second-word probability , its joint probability is .
Yoshua Bengio and coauthors' 2003 model jointly learned a distributed representation of words and a neural probability predictor. Sharing representation parameters allowed similar contexts to inform one another, rather than treating every observed word sequence as an unrelated event.[ref]
A word embedding represents a word by a vector, usually learned so that relationships in the data become useful relationships between vectors. A vocabulary of words can be stored as a matrix with rows and columns: selecting a word selects one row. Unlike a separate indicator for each word, a dense representation can share predictive information across words.
For example, training a neural language model can place words occurring in similar contexts near one another, making evidence about “cat” useful when predicting contexts involving “dog”. This is statistical similarity, not a guarantee of synonymy: opposite words can occur in similar contexts too. The 2003 neural probabilistic model learned these vectors jointly with next-word probabilities.[ref]
In online learning, a learner chooses before observing the round's loss function . Its external cumulative regret against a fixed action set is
No-regret learning seeks a guarantee , often in expectation for a randomized algorithm, under stated feedback and adversary assumptions. The average excess loss then tends to zero. The comparator is the best single action in hindsight; it does not choose the best action separately on every round.
For example, against two prediction rules, an exponential-weights learner starts with equal weights and multiplies rule 's weight by after seeing all rule losses. Sampling in proportion to the weights gradually shifts probability toward better rules. For losses in , an appropriate learning rate gives an order- expected bound for this fixed two-rule setting. This compares performance even without independent observations from one fixed distribution; it does not guarantee small absolute loss when every rule predicts badly.
Computational learning theory studies what an algorithm can learn under an explicit observation model, accuracy requirement and resource bound. Sample complexity measures how much information is needed; time complexity measures the computation used to turn it into a predictor. A class can admit statistically sufficient samples while presenting a difficult computational Search problem.
In realizable probably approximately correct learning, labelled examples are sampled independently from a fixed but unknown distribution and some hypothesis in the class labels them perfectly. The learner must return a hypothesis whose true error is at most with probability at least . For a finite class , any consistent learner satisfies this guarantee when
Indeed, a fixed hypothesis with error greater than matches all examples with probability at most ; a union bound over proves the claim. The argument bounds information requirements, but does not supply an efficient method for finding a consistent hypothesis.
Sample complexity is the number of training observations needed for a specified learning guarantee. It depends on the allowed prediction error , failure probability , the hypothesis class and assumptions about data generation. It counts observations, whereas computational complexity theory measures the work of processing them.
For a finite class containing the true binary labeling rule, suppose examples are independent and identically distributed. A fixed hypothesis with error greater than fits examples with probability at most . The union bound makes the probability that any such bad hypothesis fits at most . Thus any consistent learner succeeds with probability at least when
The derivation assumes realizability and establishes an information guarantee; it does not give an efficient search for a consistent hypothesis.
Probably approximately correct learning formalizes learning as a two-parameter guarantee. With probability at least over the training random sample and any learner randomness, the returned hypothesis must have true prediction error at most . In the realizable distribution-free setting, this must hold for every input probability distribution and every target in the specified concept class, using an appropriate polynomial number of examples; efficient PAC learning also requires polynomial running time.
“Probably” refers to the chance of obtaining a good hypothesis; “approximately” refers to that hypothesis's error on a fresh observation. For example, and require a 95% chance of returning a predictor whose error is at most 1%, rather than a claim that 95% of individual predictions are right. For finite realizable classes, the sample complexity bound follows by excluding every high-error rule that could have survived the observations.[ref]
Learning with multiple stages of representation, typically implemented by a neural network. Depth, connectivity, objective, training experience and parameter sharing are distinct design choices; a deep architecture need not be convolutional or supervised.
A generative adversarial network trains a generator to produce samples and a discriminator to distinguish generated samples from training data. The original objective is the minimax problem
The discriminator improves at detecting fakes; the generator improves at fooling it. Both can be neural networks trained by backpropagation.[ref]
For a toy dataset containing two equally frequent types of images, always producing one type gives the discriminator an exploitable imbalance even if each generated image looks plausible. Under the paper's ideal unrestricted-function analysis, the equilibrium matches the data probability distribution and gives . This ideal result does not ensure convergence for finite networks and alternating numerical updates. Ian Goodfellow and coauthors introduced the framework in 2014.[ref]
Assignment of observations to categories using measured features and a statistical rule. In geological remote sensing, features can be multispectral pixel values or derived spectral reflectance ratios; known field samples provide training labels and independent observations assess errors. Classification boundaries need not coincide with lithological contacts when illumination or cover dominates the signal.
Within-observer agreement versus reference agreement distinguishes consistency of an observer's repeated labels from concordance with a separately defined reference. The first asks whether the observer repeats a decision; the second asks whether that decision matches the comparison standard. In statistical classification, neither quantity can replace the other.
For cases, let and be one observer's labels at two readings, and the reference label. Define the two empirical agreement fractions
An original binary example has 100 cases, half reference-positive and half reference-negative. An observer reverses every reference label and repeats that reversal on the second reading. Then while . Perfect repeat agreement can coexist with complete reference disagreement. An observer always assigning the negative label also has perfect repeat agreement, but only 50 percent reference agreement in this balanced example.
A confusion matrix shows which categories contribute to disagreement, whereas a single overall percentage can conceal systematic shifts or an imbalanced case mix. Reference agreement is classification accuracy relative to that reference, not proof that the reference is infallible. A consensus panel, a later outcome and an independent molecular test answer different validation questions.
A primary 2017 study made this distinction experimentally by having pathologists interpret skin-biopsy sets twice, at least eight months apart, and comparing their interpretations with an experienced consensus reference. The study started with 240 cases and reported reproducibility separately from reference concordance.[ref] The delayed repeat reduced immediate recall, but did not transform repeated judgments into independent biological truths.
A useful evaluation preserves case identity, reading order and the exact reference procedure. If a machine learning classifier learns an observer's systematically shifted labels, it may reproduce that observer well while disagreeing with the external reference. Reporting both comparisons makes that limitation visible. Uncertainty estimates should also account for repeated cases and multiple readings rather than counting every label as an independent subject.
Probability calibration means that reported probabilities agree with the frequencies of the outcomes they describe. For binary classification, let be the true label and let be the predicted positive-class probability. Population calibration is the conditional expectation condition
Among cases receiving a value near , the positive fraction should therefore be near , with uncertainty in any finite sample.[ref]
A simple example separates calibration from discrimination. Suppose the population has a positive fraction of and a predictor always reports . Then , so it is calibrated, although it cannot rank one case above another. Conversely, replacing a useful score by a strictly increasing transformation such as preserves ranking but generally changes the claimed probability. Thus ordering cases and attaching reliable numerical probabilities are different tasks.
A reliability diagram estimates the agreement by grouping predictions and comparing each group's mean prediction with its observed outcomes. Assess it using suitable held-out observations. A calibrator fitted to predictions on the same observations used to fit the original model can inherit an overly optimistic picture of performance; fitting and evaluation need appropriate separation.[ref]
A 2017 study found substantial confidence miscalibration in the evaluated neural networks, even when prediction accuracy improved. It also tested temperature scaling as a compact post-processing adjustment. These were empirical results on specified models and datasets, rather than a theorem that all neural networks are miscalibrated.[ref]
Expected calibration error summarizes how reported confidence differs from observed correctness. For top-label statistical classification, the population quantity compares correctness probability conditional on confidence with that confidence. A commonly reported finite-sample estimate groups predictions into confidence intervals and compares the mean confidence and accuracy in each interval.[ref]
For a nonempty bin among predictions, define
Here is confidence in the selected class, not its numerical label. The empirical statistic is
Empty bins have zero weight and need no undefined bin average. The cited paper uses equal-width bins.[ref]
A synthetic example shows why the partition matters. Four predictions have confidences and correctness indicators . With one bin, accuracy and mean confidence are both , so the estimate is zero. With four equal-width bins on , only the last two are populated. Their accuracy/confidence pairs are and , each with half the observations. Thus
This is ten percentage points, despite unchanged predictions and labels.
A zero coarse-bin result can conceal opposing gaps; it does not establish perfect probability calibration or agreement within every subgroup. Report bin boundaries, sample size, confidence convention and scale. Reliability diagrams reveal where the gaps occur, while a scalar expected calibration error supplies their sample-weighted summary. It is distinct from the fraction of incorrect classifications.
Temperature scaling is a method of probability calibration that divides a model's neural network logits by one fitted positive scalar before applying the softmax function. The temperature is selected after model training, using labels in a held-out validation set to minimize the negative log-likelihood. It adjusts reported probabilities without retraining all model weights.[ref]
For class scores and ,
For the synthetic two-class scores , the first-class probability is
The selected class remains the first while its reported confidence decreases.
The preservation of the selected class follows directly: dividing by positive preserves every score ordering and equality, and exponentiation is strictly increasing. Thus the set of classes attaining the largest score is unchanged. This concerns ordering between classes within one example; it does not assert preservation of confidence ordering between different examples.
A motivating measurement in the original study compares reliability diagrams for a 110-layer image-classification network. Its reported expected calibration error changes from before calibration to after temperature scaling. This is a result for that experimental setup and binned metric, not a guarantee for every classifier or input distribution.[ref]
Use separate data for fitting the temperature and for final evaluation. One scalar can improve an overall confidence mismatch but cannot represent every class-specific or input-dependent error. The name refers to this probability transformation; no physical temperature is being measured.
A reliability diagram compares predicted probabilities with observed outcome frequencies to assess probability calibration. For the positive-class version of binary classification, partition observations into bins according to their predicted probabilities . For every nonempty bin, plot
where is for a positive outcome and otherwise. Agreement places the estimated points near the diagonal . Empty bins have no observed fraction and should not be plotted as zero.[ref]
Binning can hide important structure. Consider ten cases each assigned , of which eight are positive, and ten cases each assigned , of which two are positive. Separate bins give and , revealing strong disagreement. Merge all 20 cases into one bin: the mean prediction becomes and the positive fraction is . The single point lies on the diagonal despite the two-group discrepancy.
Figure 1.
Merging bins can hide disagreement in a reliability diagram.
Original synthetic binary classification example with the same 20 predictions and outcomes in both panels. Points show positive-class frequencies; the diagram does not establish a population guarantee. Details.
Report bin definitions and counts, since a point based on ten cases has different sampling uncertainty from one based on thousands. Some classification diagrams instead plot confidence in the selected label against the fraction of correct selections. That convention and the positive-class version answer related but distinct questions, so label the axes and the meaning of the outcome explicitly.[ref]
A confidence score is a numerical output used to express how strongly a system supports a prediction, particularly in statistical classification. Its meaning depends on the system: it may be an estimated probability, a distance from a decision boundary, or another score whose ordering is useful. A number between zero and one does not by itself establish a probability interpretation. Probability calibration concerns whether predicted probabilities agree with observed frequencies.[ref]
Consider a synthetic binary statistical classification example. Among independent test cases assigned a positive-class score near , suppose actually belong to that class. Their observed fraction agrees with the average predicted probability. If only belong to the positive class, the same scores overstate the observed positive frequency in this group. A reliability diagram groups predictions by their estimated probability and compares each group's mean prediction with its observed positive fraction. Finite groups have sampling variation, so agreement in one group is evidence to assess with its sample size, rather than a guarantee about each case.[ref]
Ordering and probability calibration answer different questions. For scores in , replacing every score by preserves their order but changes to . Thus an unchanged ranking can accompany very different probability statements. Conversely, a system assigning the overall positive fraction to every case can have useful aggregate probability calibration while failing to distinguish cases.
A confidence score can support a threshold for accepting a prediction or passing it to another process. Select and assess that threshold using examples separate from model fitting and representative of the intended inputs. A threshold does not establish its own error rate; observations on suitable test data supply that evidence. Distinguish a positive-class probability from the score of whichever class was selected: they are different quantities when the selected class changes.
Discriminant analysis constructs statistical rules distinguishing labelled classes from their measured feature values. A common generative approach models the class-conditional probability distribution and applies Bayes' theorem to compare posterior class probabilities. Linear discriminant analysis uses multivariate normal distributions with a shared covariance matrix; allowing a different covariance matrix for each class gives quadratic discriminant analysis.[ref]
For two equally likely one-dimensional classes, suppose and . Their log-likelihood ratio is
Choosing the larger posterior therefore selects for , with a tie at one. Different class probabilities move this threshold. Estimating means and covariance from training data supplies a fitted rule, while independent evaluation tests whether its assumptions generalize.
For a binary classifier, the conditional probability of the target condition given a positive classification. If its base rate is , its true-positive probability is , and its false-positive probability is , Bayes' theorem gives . The denominator is positive whenever a positive classification can occur.

Articles by others on the same topic (1)

Machine learning by Ciro Santilli 40 Updated 2025-07-16
The main reason Ciro Santilli never touched it is that it feels that every public data set has already been fully mined or has already had the most interesting algorithms developed for it, so you can't do much outside of big companies.
This is why Ciro started Ciro's 2D reinforcement learning games to generate synthetic data and thus reduce the cost of data.
The other reason is that it is ugly.