Variance
Variance is the expected squared deviation of a random variable from its mean and measures the dispersion of its values.
Math and Architectures of Deep Learning
A scalar measure of how dispersed a set of values is around their mean, used here as the quantity assumed known in one conjugate-prior case.
- How it is used
- Characterizes distribution spread for probability modeling, PCA, dimensionality reduction, and Gaussian parameter estimation.
- How deep it goes
- Defines variance from expected squared deviation, derives a computational identity, and extends it to directional covariance forms for PCA.
- Examples
- Uses nonuniform one-dimensional points, sampled Bernoulli/binomial/Gaussian distributions, and Gaussian bells with changing spread.
- What you can do after
- Evaluate/understand it as squared spread around a mean and as directional spread through a covariance matrix.
Read how Math and Architectures of Deep Learning explains variance →
Cyber Threat Hunting
Variance is the average squared deviation of values in a data set from its mean and measures the data's spread.
- How it is used
- Detects consistency in repeated network-connection intervals while searching for malicious beaconing.
- How deep it goes
- Defines variance from squared deviations and demonstrates grouped calculation in a DataFrame, while using standard deviation for consistency decisions.
- Examples
- Works through grouped connection intervals and exercises connections between 10.0.0.6 and 208.80.154.224 using graphs and a histogram.
- What you can do after
- Apply it via Pandas to calculate grouped variance for connection intervals during a beaconing investigation.
Statistics Every Programmer Needs
Variance is a measure of the average squared deviation of values from their mean.
- How it is used
- Measures spread for quality-control monitoring and helps specify uncertainty in Monte Carlo simulation inputs.
- How deep it goes
- Defines variance through squared deviations and explains its square-root relationship to standard deviation, without developing a separate variance estimator.
- Examples
- Compares simulated and observed stock-price standard deviations and tracks piston-ring sample variability with an s-chart.
- What you can do after
- Evaluate/understand it when interpreting simulated spread or selecting variability measures for quality-control charts.
Read how Statistics Every Programmer Needs explains variance →
Statistics Slam Dunk
The variance method measures statistical dispersion by averaging squared deviations from the mean.
- How it is used
- Measures numeric spread when evaluating consistency, volatility, risk, and NBA competitive parity.
- How deep it goes
- Defines squared deviations, demonstrates grouped R computation and chart interpretation, and notes outlier sensitivity without formal proofs.
- Examples
- Uses two short numeric vectors and season-by-season NBA regular-season wins before and after the salary cap.
- What you can do after
- Apply it via base R var() to summarize grouped numeric data and interpret changes in spread.
Effective Data Analysis
Variance is the average squared deviation of observations from their mean and measures their dispersion.
- How it is used
- Uses variance alongside other summary statistics to assess dispersion before inferential testing.
- How deep it goes
- Explains variability through summary measures, distribution shape, and reporting trade-offs.
- Examples
- Contrasts distributions sharing a mean of 10 and illustrates the derivation of standard deviation and standard error from variance.
- What you can do after
- Evaluate dispersion alongside distribution shape when choosing summaries for stakeholder reporting.
Timeless Algorithms, The Foundational Ideas
Variance is the model's sensitivity to changes in the training sample, reflected in how its behavior varies across samples.
- How it is used
- Frames training-sample sensitivity as a generalization problem and a reason to combine unstable decision trees.
- How deep it goes
- Defines sample sensitivity and explains tree instability, aggregation, and correlated-error limits without deriving a formal variance decomposition.
- Examples
- Uses deep trees with changing splits and soft-margin SVMs with different penalty strengths to illustrate sample sensitivity.
- What you can do after
- Enables evaluation of how tree constraints, aggregation, and SVM regularization address sensitivity to training samples.
Read how Timeless Algorithms, The Foundational Ideas explains variance →
Build AI Drug Discovery Pipelines
Distribution variance is the expected squared deviation from a distribution's mean and measures its spread.
- How it is used
- Diagnoses overfitting and guides choices about model complexity, training data, and regularization.
- How deep it goes
- Explains model-fit sensitivity through examples, learning curves, and validation curves without calculating a standalone variance statistic.
- Examples
- Uses polynomial fits, RANSAC and SVR learning curves, decision-tree regularization, and Gaussian-process predictions.
- What you can do after
- Diagnose overfitting from train-test error gaps and choose whether to collect data or regularize the model.
Read how Build AI Drug Discovery Pipelines explains variance →
Advanced Algorithms and Data Structures
Variance is the mean of the squared differences between values and their mean, measuring their dispersion.
- How it is used
- Guides SS-tree node splitting to limit bounding-sphere size and overlap during similarity search.
- How deep it goes
- Defines mean and variance, then develops coordinate selection and minimum-variance split procedures in pseudocode.
- Examples
- Compares eligible split indices for eight projected entries with a minimum node occupancy of three.
- What you can do after
- Build it from scratch: select a maximum-variance axis and a split index minimizing the resulting variance sum.
Read how Advanced Algorithms and Data Structures explains variance →
AI Model Evaluation
Variance is a measure of how much a set of observed outcomes fluctuates around its expected or average value.
- How it is used
- Uses variance to distinguish evaluation noise from meaningful differences in AI experiments and LLM-judge decisions.
- How deep it goes
- Defines high variance and provides experiment-design, monitoring, and triage guidance without deriving a variance formula.
- Examples
- Illustrates variability with movie-recommender watch time and repeated LLM-judge scores for model variants.
- What you can do after
- Diagnose evaluation noise by repeating judge tests, checking order sensitivity, and comparing canary results with a baseline.
Grokking Bayes
Variance is the expected squared deviation of a random variable from its mean and equals the square of its standard deviation.
- How it is used
- Quantifies spread and uncertainty in continuous parameters, especially when comparing prior and posterior beliefs.
- How deep it goes
- Defines variance through standard deviation, applies it to normal priors and posteriors, and notes limitations for discrete uncertainty.
- Examples
- Uses a square-footage price slope, a normal prior with variance 100², posterior updating, and categorical or relabeled discrete possibilities.
- What you can do after
- Evaluate uncertainty in continuous distributions and interpret changing prior or posterior spread.
Pandas Workout: 200 exercises to make you a stronger data analyst
The average of squared deviations from the mean before taking a square root.
- How it is used
- Explains how to quantify spread around a Series mean before interpreting standard deviation.
- How deep it goes
- Works through the arithmetic steps and pandas divisor choice, but stops short of broader statistical theory.
- Examples
- Uses a Series expression with squared deviations and s.std(ddof=0) to compare population calculations.
- What you can do after
- Apply variance arithmetic and choose ddof=0 when matching the population calculation in pandas.
Read how Pandas Workout: 200 exercises to make you a stronger data analyst explains variance →
Grokking Statistics
A measure of dispersion equal to the average squared deviation from a distribution's mean.
- How it is used
- Quantifies spread for descriptive statistics, model-reliability assessment, and inference about population variances.
- How deep it goes
- Defines variance, explains population and sample denominators, and demonstrates manual and NumPy calculations without deriving the formulas formally.
- Examples
- Uses collie weights, contrasting height groups, and daily temperatures to illustrate low and high variance.
- What you can do after
- Apply it via NumPy or a manual Python calculation and interpret spread as a clue about prediction reliability.
Data Without Labels
Variance is a measure of the average squared deviation of values from their mean.
- How it is used
- Uses variability to select informative lower-dimensional projections during principal component analysis.
- How deep it goes
- Explains variance through PCA projections and orthogonality, but stops short of deriving its statistical formula.
- Examples
- Uses a house-price dataset, illustrative variable combinations, vector-space projections, and principal-component diagrams.
- What you can do after
- Evaluate PCA directions by the variance they capture and understand how dimensionality reduction preserves dataset structure.
Bayesian Optimization in Action
Variance is the expected squared deviation of a random variable from its mean and measures the spread of its distribution.
- How it is used
- Measures uncertainty and spread in individual variables within multivariate Gaussian models and their posterior updates.
- How deep it goes
- Defines variance through covariance-matrix diagonals and explains posterior changes, but defers the math-heavy conditioning derivation.
- Examples
- Uses a three-variable house-price Gaussian, parallel-coordinate plots, confidence intervals, samples, and observations such as B = 4.
- What you can do after
- Understand variance as marginal uncertainty and interpret how observations change posterior uncertainty in correlated Gaussian variables.
Read how Bayesian Optimization in Action explains variance →
Machine Learning System Design
An error caused by a model's sensitivity to small fluctuations in its training data, producing substantially different behavior on new data.
- How it is used
- Guides model-complexity decisions, validation design, and consistency measurement across data and model changes.
- How deep it goes
- Defines sensitivity-driven error, relates it to overfitting and bias, and gives validation tradeoffs without mathematical derivation.
- Examples
- Uses search-result rank variance, fraud-probability consistency, and cross-validation fold selection as concrete applications.
- What you can do after
- Apply via validation schemas and consistency metrics to identify unstable models and choose practical bias–variance tradeoffs.
Ensemble Methods for Machine Learning
Variance is a measure of the expected squared deviation of a random variable from its mean.
- How it is used
- Diagnoses poor generalization by identifying sensitivity to training-data variation within the bias-variance tradeoff.
- How deep it goes
- Explains estimator sensitivity, overfitting, and ensemble-based reduction, but stops short of formal derivations.
- Examples
- Uses SVM complexity curves, six diverse regressors, prediction averaging, and ensemble performance bands.
- What you can do after
- Diagnose/debug with it by recognizing overfitting and evaluating whether averaging improves robustness and generalization.
Read how Ensemble Methods for Machine Learning explains variance →
Investing for Programmers
Variance is a statistical measure of the average squared deviation of observations from their mean.
- How it is used
- Uses variance to compare fluctuation and dispersion in stock prices or returns during technical analysis and risk management.
- How deep it goes
- Defines squared deviation, contrasts variance with standard deviation, and demonstrates aggregation without deriving the formula or statistical theory.
- Examples
- Demonstrates variance with Python aggregations and 2023 log-return statistics for Apple, Coca-Cola, and NuScale.
- What you can do after
- Apply variance through pandas aggregations and interpret it alongside standard deviation when comparing financial return dispersion.
Build Python Web Apps with Streamlit
Variability is the degree to which a model produces different outputs for the same or similar inputs.
- How it is used
- Guides the amount of creativity and repeatability required from large language model outputs.
- How deep it goes
- Defines probabilistic variability and discusses controls, but stops short of detailed control implementation.
- Examples
- Uses poetry, mathematical evaluation, and repeated trivia questions to contrast creative and predictable outputs.
- What you can do after
- Apply it via model variability controls and prompt engineering to shape creative or predictable responses.
Read how Build Python Web Apps with Streamlit explains variance →
Outlier Detection in Python
Variance is a statistical measure of dispersion equal to the average squared deviation from the mean.
- How it is used
- Uses variance to prioritize PCA components and interpret multivariate outliers.
- How deep it goes
- Explains variance through component transformation and explained-variance inspection, without developing a standalone statistical derivation.
- Examples
- Uses correlated synthetic two-dimensional data, two contrasting outliers, PCA components, and a scikit-learn implementation.
- What you can do after
- Apply scikit-learn PCA to transform tabular data and inspect component variance when investigating outliers.
The Well-Grounded Data Analyst
Variance is a statistical measure of the average squared deviation of observations from their mean.
- How it is used
- Uses variance to assess spread across survey groups and decide which segmentation features meaningfully distinguish records.
- How deep it goes
- Interprets variance through distributions and feature inspection, without deriving the statistic or detailing its computation.
- Examples
- Compares coding-experience distributions across AI attitudes and screens customer-segmentation dimensions for meaningful variation.
- What you can do after
- Evaluate distributions and choose potentially useful segmentation dimensions using visible variation between records or groups.
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
Variance is a statistical measure of the average squared deviation of values from their mean.
- How it is used
- Supports statistical primitives used by K-means clustering, alongside mean, standard deviation, and z-scores.
- How deep it goes
- Defines and implements the formula for arrays of Doubles, but defers elementary statistics beyond rudimentary mean and standard deviation.
- Examples
- Calculates variance for [600, 470, 170, 430, 300], yielding 21,704.
- What you can do after
- Build it from scratch as a computed Array<Double> property and test it with sample data.
CUDA for LLMs
Variance measures the average squared deviation of values from their mean.
- How it is used
- Uses variance to standardize each feature row as part of LayerNorm.
- How deep it goes
- Calculates variance from squared deviations and traces its warp reduction in a fused kernel.
- Examples
- Uses the row [1, 2, 3, 4] and a CUDA warp-based LayerNorm kernel.
- What you can do after
- Apply variance in CUDA reductions to normalize rows in a fused LayerNorm kernel.
Delivering Machine Learning Projects: From design to deployment
Variance is a statistical measure of the average squared deviation of values from their mean.
- How it is used
- Guides exploratory data analysis by sizing validation sets and informing training-data ordering.
- How deep it goes
- Connects dataset variance to validation-set sizing and training order, without detailing calculation methods.
- Examples
- Uses key-variable spread as the signal for validation-set sizing and training-order decisions.
- What you can do after
- Apply it via exploratory data analysis to size validation data and inform training-data ordering.
Read how Delivering Machine Learning Projects: From design to deployment explains variance →
Deep Learning with R, Third Edition
Variance is a statistical measure of the squared variability of values around their mean.
- How it is used
- Uses variance to make latent representations stochastic and continuously meaningful for image generation.
- How deep it goes
- Explains variance as a distribution parameter and shows its role in latent sampling, without deriving statistical formulas.
- Examples
- Uses image encoding, z_mean, z_log_var, epsilon, latent sampling, and reconstruction as concrete examples.
- What you can do after
- Understand how variance controls stochastic latent sampling in a variational autoencoder.
Read how Deep Learning with R, Third Edition explains variance →
Also covered in
- Privacy-Preserving Machine Learning
- Experimentation for Engineers
- Build a Robo-Advisor with Python (From Scratch)
- Causal Inference for Data Science
- Natural Language Processing in Action, Second Edition
- Machine Learning Algorithms in Depth
- Reinforcement Learning from Human Feedback
- Grokking AI Algorithms, Second Edition
- Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
- Optimization Algorithms: AI techniques for design, planning, and control problems
- Applied Reinforcement LearningIn early access (MEAP)
- Think Distributed Systems
What to know first
- meanThe mean is a measure of central location equal to the arithmetic average of numerical observations, or the probability-weighted average of a random variable’s possible values.
- normal distributionA normal distribution is a continuous probability distribution with a symmetric, bell-shaped density determined by its mean and variance.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- standard deviationStandard deviation is the nonnegative square root of variance and measures the dispersion of values around their mean in the same units as those values.
Related concepts
- principal component analysisused by · Principal component analysis is a linear statistical technique that represents data along orthogonal directions, called principal components, ordered by the variance they capture.
- standard deviationused by · Standard deviation is the nonnegative square root of variance and measures the dispersion of values around their mean in the same units as those values.
- Cramer-Rao lower boundmeasured by · The Cramér-Rao lower bound is a theoretical lower limit on the variance of unbiased estimators under specified regularity conditions and a probability model.
- data aggregationaddressed by · Data aggregation is the process of combining multiple data values, records, or observations into a consolidated or summarized result.
- meanuses · The mean is a measure of central location equal to the arithmetic average of numerical observations, or the probability-weighted average of a random variable’s possible values.
- reduction operationproduced by · A reduction operation combines multiple input values according to a rule to produce fewer results, often a single aggregate.
Questions about variance
What is variance?
Variance is the expected squared deviation of a random variable from its mean and measures the dispersion of its values.
Which Manning books explain variance?
Math and Architectures of Deep Learning, Cyber Threat Hunting, Statistics Every Programmer Needs, Statistics Slam Dunk, Effective Data Analysis, Timeless Algorithms, The Foundational Ideas, Build AI Drug Discovery Pipelines, Advanced Algorithms and Data Structures and 16 more.
What should I know before learning variance?
Manning books that teach variance usually introduce mean, normal distribution, language model and standard deviation first.
What is variance also called?
Variance is also called var.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.























