Two wooden pieces sit in a tray on a marked rail. The reference tray has pieces at positions zero and four. In a second tray, the pieces stand at one and three. Both arrangements balance around position two when the pieces carry equal weight. A summary that records only the average returns the same value for both. But the trays do not contain wood at the same positions. To make the first arrangement look like the second, some mass at each end has to move inward.

The first Wasserstein distance makes that rearrangement a number. It treats each arrangement as a distribution of equal total mass on the same measurement axis and asks for the least possible cost of redistributing one into the other. Here the cost per unit of mass is proportional to distance moved, counted without signs. Half the mass must move one unit right and half one unit left. The mean of the positions has not changed because the signed movements cancel. The cost remains one position unit because leftward and rightward moves both count.
The important words are “distribution,” “least,” and “same measurement axis.” The calculation compares placements and proportions rather than keeping track of which piece was issued to which tray. It chooses the least expensive redistribution consistent with the inputs. And its result depends on how distance along the axis is measured. Those qualifications explain why it finds a difference missed by a mean but cannot stand in for an identity check, a test of a physical mechanism, or a declaration that a difference of one is large enough to matter.
Toy transport distances from one reference
Illustrative only. The reference positions are the invented list zero and four. The comparisons use the same reference and assign one-half of the total mass to each observed position in every two-piece arrangement. They are not measurements, published study results, or tolerance limits. The unit is position units on the common axis.
| Comparison | Position units |
|---|---|
| Same positions | 0 |
| One unit shifted inward on both sides | 1 |
The first row compares zero and four with zero and four; no relocation is needed. The second compares zero and four with one and three. An optimal plan sends the mass at zero to one and the mass at four to three. Each travels one position unit. Since the pieces carry half the mass apiece, the plan costs one-half times one plus one-half times one, or one. It is optimal because each reference position is at least one unit from either destination; even if mass were split, no portion could be sent less than one unit.
Counting the two movements without dividing by the total equal weight would produce two units for physically moving two whole pieces. The chart reports the cost per unit of normalized mass, not the sum over two unit-weight pieces. Pairing zero with three and four with one also arrives at the final arrangement, but costs three per unit of mass. The distance uses the cheaper permitted reassignment, not the first match someone happened to write in a spreadsheet.
Same center is a much narrower statement than same distribution
The mean is the point that balances a set of positions under the given weights. In the first tray, zero and four cancel each other's deviations from two. In the second, one and three do so as well. A statement about the mean is exactly right if the question is the center of balance. It does not summarize how much sits near that center, how wide the occupied positions are, or whether the bulk of the material has shifted in one direction.
To see what the mean leaves open, imagine a third tray with both pieces at two. It also balances at two. Compared with the reference, every bit of its mass at two is two units from its eventual position, regardless of which way it is sent. The distance is two. The reference, inward-shifted arrangement, and centered arrangement share a mean, yet their masses occupy different places. The original chart deliberately shows only the first two comparisons; the third example illustrates just one of many distributions consistent with the same mean.
There is a useful mathematical connection that does not make the measures redundant. For any permitted matching or transport plan, the average signed change equals the difference of the means. The average magnitude of the changes cannot be smaller than the magnitude of their signed average. Taking the least cost across permitted plans preserves that bound. On a common line with finite means, the first Wasserstein distance is therefore at least the absolute difference in means. Zero mean difference gives only a lower bound of zero, not a prediction that the distance must be zero.
A pure shift provides a case where the bound is exact. Compare zero and four with two and six. Both pieces can move two units right, producing a cost of two with a mean shift of two. No permitted plan can do better because of the mean bound. Compare that case with the centered arrangement, whose distance from the original is also two but whose mean remains unchanged. The distance alone cannot distinguish translation from concentration around the original midpoint. A plot or supplementary summaries can show what kind of change made the same scalar possible.
Dispersion measures could help clarify that example. A variance or spread summary would pick up the inward move while the average stayed stable. In a different setting even several shared moments do not necessarily imply identical distributions. The practical decision is not to replace the average everywhere. It is to select a summary that answers the question and, when needed, provide another summary or graphic for a feature the first one cannot resolve. A report designed around retuning a fixture may need direction; a report designed around overall distributional departure may need a magnitude.
The transport plan matches masses, not specimen IDs
The SciPy reference for one-dimensional Wasserstein distance gives the first-order transport interpretation and the equivalent comparison of cumulative distributions. The inputs can represent observed positions of equally weighted samples or positions with explicitly assigned weights. They describe how much mass sits where. The function is not asked to preserve the serial number of a specimen already paired by a laboratory or by time.
An easy counterexample shows why. Two pieces have permanent marks, A and B. At first A is at zero and B is at four. Later they exchange positions. A tracking log would show that each moved four units. The resulting distributions, ignoring the marks, are exactly the same, because each still has half its mass at zero and half at four. A Wasserstein distance on the unmarked positions is zero. The null result is not a measurement failure. It answers a different question from the one answered by the tracking log.
That difference matters if the measurement originally follows the same specimens through time. If analysts want the typical amount each object moved, compute it from correspondence records with specimen identities, if available. If they want to compare the spread and centers of two batches regardless of manufacturing order, a distribution distance can be useful. Neither result claims the other. Mix them only when a project explicitly states why the minimum cost across anonymous reallocations is appropriate for its decision.
In the opposite direction, a nonzero distance need not imply anyone tracked actual movement. The reference tray could be one cohort and the comparison tray an entirely new one. The transport is a way of defining how different distributions are, not a story about wood physically traveling from one sampled population into the next. The word “require” in the title describes the least hypothetical rearrangement on the shared axis. It does not mean that every real object in a nonzero-distance dataset must have moved. In this particular inward toy example, neither original support position is a destination, so all normalized mass has to be reassigned somewhere else.
The same principle applies to classification. A dataset can contain the same number of each label before and after a classifier runs while individual assignments are wrong. If nominal classes have no defensible numeric distance, assigning them arbitrary positions and calculating transport adds little and may make accidents of coding look scientific. Evaluating label accuracy needs reference labels paired to the items. Comparing distributions of a genuinely ordered numeric variable is a separate use. A metric can ignore identities in a principled way and still be the wrong tool when identities are the issue.
On a line, sorted matching has a reason
With equal sample counts and equal weights, sort each list of positions and pair corresponding ranks. The average absolute gap gives the one-dimensional first Wasserstein distance. Sorting each list anew is appropriate for this purpose because the inputs describe anonymous distributions. If the order originally encoded times or specimen IDs, those relationships are being intentionally ignored. The sorted method is justified by the linear axis and the absolute cost, not by a rule that every comparison is improved by sorting.
There is an elementary way to see why crossing links are unnecessary. Take two source positions with a clear left-to-right order and two destination positions with the same ordering. If the left source is sent to the right destination and the right source to the left destination, uncross the two assignments. On a line, the sum of the direct left-left and right-right distances is no larger than the crossed sum. Each reassignment avoids needless overlap of travel without sacrificing either arrival. Repeating this until the assignments are ordered gives an optimal plan; equality in the uncrossing step is possible, so the optimum plan is not always unique.
The original tray makes this strictly visible. Zero to three costs three, and four to one costs three. The uncrossed plan costs one for each. But on a different toy rail with sources at zero and one and destinations at two and three, either one-to-one assignment has the same total distance of four. All movement is to the right, and the mean shift already gives a tight lower bound. The distance can have a unique value even when several movements attain it. A diagram that draws one optimal plan should not describe it as the only possible explanation for a comparison.
Ties in measured positions do not cause a problem for sorted calculations with equal mass. Several values can occupy the same position because instruments round, or because several pieces really sit in the same marked groove. In an empirical distribution each occurrence contributes its share. Combining the repeated positions into a weighted point is fine if the combined weight is the sum of the occurrences. Deduplicating the list without replacing the lost weights changes the distribution. This is a common source of a surprising answer when a sample table was converted into a catalog of unique measured values.
For a bigger equal-size example, suppose four pieces in one tray sit at zero, zero, two, and six. A second tray places them at one, one, two, and four. Both means are two. The rank-matched gaps are one, one, zero, and two; their mean is one. Unlike in the two-piece inward shift, the position at two can keep its mass where it was. The same scalar value can thus describe a comparison where all the reference mass changes position and one where some remains aligned. The number summarizes minimal total distance per unit mass; it does not state the fraction of pieces that move.
A cumulative view exposes what crossed each boundary
On the shared axis, consider a cut anywhere between zero and four. The cumulative distribution is the fraction of mass at or to the left of the cut. If the fractions differ, there is excess mass on one side in one arrangement that must go across the cut to achieve the other. The absolute gap in the fractions describes the minimum amount that has to cross at that particular position. Summing that requirement across position, as an area under the absolute cumulative gap, is equivalent to the one-dimensional first Wasserstein distance.
For the toy reference and inward comparison, between zero and one the reference has half its mass to the left and the comparison has none. That produces an absolute gap of one-half over length one. Between one and three both have half to the left, so the gap is zero. Between three and four the comparison has all its mass to the left, while the reference still has only half. The absolute gap is again one-half over length one. The total area is one. The conventions at the exact jump positions do not affect the integral because a single location has no interval width.
If the difference were integrated with its sign instead, the two outer contributions would cancel. This parallels the cancellation in the mean shift. Taking the absolute gap first prevents positive and negative differences from washing out. The signed and absolute comparisons can both be useful. If the purpose is specifically to know whether the center moved to the right, direction belongs in the result. If the concern is net rearrangement as defined by the cost, the magnitudes matter even when there is no chosen direction. The cumulative display can show both without asking one number to convey both.
The cumulative view is especially helpful with unequal sample sizes. Suppose one tray is represented by two measurements, and another by four. When each list is converted to a probability distribution, the steps are one-half and one-quarter, respectively. There need not be a natural one-to-one pairing. Half a unit of mass can be divided between two quarter-unit destinations. Integrating the absolute gap in cumulative mass, or matching normalized quantile levels under the equivalent view, can handle the uneven jumps without throwing away observations to force equal list sizes.
This also explains why a missing or duplicate observation may matter more in a sparse region than a change of the same number of rows elsewhere. The cumulative gap is weighted by horizontal interval lengths. A gap of one-tenth that continues over ten position units makes the same area as a gap of one-half continuing over two. Depending on the intended use, the difference between scattered tail changes and compact middle changes may be more informative than their equal contribution to an overall metric. A short note about which intervals account for most of the distance helps a reader interpret a high-level report.
An empirical cumulative graph never needs to conflate the probability on its vertical axis with the units of the resulting distance. The gap itself is a fraction and has no units. Multiplying by width gives position units, matching the normalized transport view. This dimensional check is useful for finding mix-ups in spreadsheet implementations. Summing absolute gaps at observed values without multiplying by interval widths would weight occupied positions, not movement across the common line. Such a sum could be an intentional statistic under a different name; it is not the transport quantity in the toy chart.
Energy distance is an alternative, not another name
The SciPy energy distance documentation describes a different one-dimensional distribution metric. In its cumulative-distribution formulation, it squares the cumulative gap, integrates over the line, multiplies by two, and takes the square root. The first Wasserstein comparison uses the absolute gap without squaring it before integration. The result is that large differences in cumulative mass and small extended differences can contribute differently under the two metrics.
The inward tray example offers an accidental numerical match. The squared gap is one-quarter over each of the two width-one intervals. The integrated squared gap is one-half. Twice that is one, and the square root is one. This does not make the methods equivalent. For a reference containing all its mass at zero and a comparison containing all its mass at four, the first Wasserstein distance is four. The energy distance in SciPy's convention is the square root of eight, because the squared gap equals one over an interval of length four. Compare calculations on several examples, not one convenient coincidence.
The units explain still more. If all position coordinates are multiplied by a positive common factor, the first Wasserstein distance is multiplied by that factor. SciPy's one-dimensional energy distance under the displayed definition scales by the square root of the factor because the change in horizontal width occurs inside the square root. In dimensional terms it has the square root of the underlying position unit; the squared version some texts quote has position units under that convention. Reporting the exact metric and convention matters more than treating either scalar as an interchangeable score with a common reference range.
Researchers and data teams may choose whichever difference is appropriate for what they are monitoring, possibly alongside other summaries. A metric that suits a question about how far normalized mass would have to move is not automatically the best one for every departure in shape. If two groups publish different definitions under similar wording, reconcile their methods before comparing values. Do not average several statistics just because they arose from the same two lists. Combining them can create a number for which neither cost nor statistical meaning has been defined.
Weight represents a population decision
By default, giving each row the same weight often seems natural. It means that every recorded position contributes equally after normalization. Sometimes the meaningful unit is a specimen rather than a reading. If one wooden piece was measured four times and another once, weighting all five readings equally describes the distribution of readings, giving the often-measured piece greater influence. Equal weight per physical piece would be a different construction, and the correct choice depends on what the inventory is trying to track.
One set of weights might describe survey representation, another physical mass, and a third the importance a team assigns to some positions. All can affect the comparison, but they do not have the same interpretation. If actual carriers of material are unevenly sized and the quantity of interest is how material is spatially distributed, physical mass could be a sensible weight. If the project is about the experience of a typical recorded part, piece count might be a better match. It is important to decide which mass the transport model represents before comparing it to the actual carrying cost of moving stock.
Normalized weights eliminate differences in overall mass or count unless those quantities change the distribution's proportions. Suppose the reference tray has one piece at each endpoint, and a later tray has ten at each endpoint. If the calculation compares each as a distribution of total mass one, the distance is zero. The locations and relative shares agree, although the trays contain different numbers of pieces. Report totals separately when they matter. A relative redistribution statistic is not an inventory balance, and simply inserting larger counts into a function that normalizes its input will not make stock levels appear in the distance.
Pooling choices can create or hide differences just as weights can. A team might average a metric across several production lines or pool all the parts before doing a single calculation. Lines with different output totals influence a pooled distribution according to the chosen weight. A per-line comparison instead can reveal that two shifts offset one another in aggregate. Even if a site-level mean or distance is useful, a decomposition by meaningful groups can show where the comparison is happening. Adding group-specific distances is not automatically the same as calculating a pooled distance.
For a seemingly obvious case, consider two lines at opposite ends of a shared rail system. Each line swaps its recorded positions with the other while maintaining the same total number of observations. Pooled distributions could be identical, yet neither line matches its own reference. A pooled report answers a legitimate question if any part from either line is equivalent for the intended purpose. If placement within a particular line matters, the pooling has discarded the label needed to evaluate that. This is another way an exactly zero distance can coexist with substantial change in a related record.
A common ruler is part of the comparison
Both arrangements need to be expressed on one calibrated axis before movement costs are meaningful. If the zero point is changed for both, there is no change in the difference between any pair of positions. If the same positive scale conversion is applied to both, all movement costs rescale predictably. But converting one tray and not the other invents a difference. The fact that two columns contain numbers does not mean they belong in the same comparison until their units and reference origin are aligned.
A simple unit check is to rewrite the toy coordinates in millimeters rather than centimeters under the assumption that their original units were centimeters. Then the distance of one centimeter becomes ten millimeters. It is the same physical contrast, not ten times as much displacement. If a report shows “10” in a new year and “1” in an old one, readers cannot tell whether the change is physical unless the unit is printed or evident in the data. A properly labeled result travels with the ruler, even in a dashboard that offers conversions automatically.
Some transformations change the meaning more radically. A log scale measures ratios through differences in transformed coordinates rather than direct physical lengths in the original units. Independently standardizing two batches by their own means and spreads can deliberately remove location and scale differences one might otherwise want to detect. A report using transformed coordinates should explain why movement on that axis is meaningful and should not label the resulting value as original distance. Standardization can support a focused comparison, but it does not create an estimate in the original ruler units.
A circular coordinate is another caution. Directions near 359 degrees and one degree may be close around a circle but far apart if treated as positions on a straight line beginning at zero. The one-dimensional metric in the illustration takes an absolute difference on a line; crossing the end of a circular scale calls for a different ground cost if the intent is physical proximity. Similarly, if positions are measured in two dimensions, a comparison on one projection can erase differences in the other. One should not promise the behavior of a multidimensional comparison using a calculation designed for a simple rail.
Discretization can also affect measured agreement. One instrument may round to marks while another records fine positions. Two pieces in a groove can end up at the same displayed tick even if the raw positions differ. A comparison at displayed resolution and a comparison of raw estimates are different tasks. If a unit change merely advocates displaying more digits, it does not restore information lost during earlier rounding. Before attributing a small distance to a genuine shift, investigate whether calibration, precision, and any variable bin definitions were matched.
Finite records are not an official tolerance
The chart is exact for its invented arrays. A distance computed on a real pair of samples is exact for the represented empirical distributions, subject to numerical and input quality. It does not by itself tell someone how far apart the underlying populations are. Even two samples taken from the same stable process can differ in their occupied positions just by sampling. The amount of ordinary variation depends on sample size, the process, measurement repeatability, and which cases make it into the data. Chart values cannot acquire reference intervals just because they are straightforward to calculate.
A comparison drawn from one morning can therefore have a very different evidentiary status from comparisons repeated across many independent batches. If hundreds of readings come from a few potentially similar specimens in two production runs, using the row count as though it described hundreds of independent process changes overstates the evidence. A monitoring report can say where the values came from, which units were sampled and related, and whether the purpose is to describe the actual observed runs or make an inference beyond them. Those choices are independent of which distance formula was used.
Observations at unusual positions deserve attention without automatic removal. The absolute transportation cost gives distant mass a contribution proportional to how far it must go. A few extreme values may affect a result even if the rest of the distribution barely changed. They could be genuine rare parts, instrument mistakes, unsupported inputs, or consequences of a new logging rule. Inspect them against the intended eligibility criteria, and apply corrections symmetrically to the two groups. Deleting rows because they enlarged a metric would obscure an outcome rather than check it.
A useful tolerance, if one is needed, should arise from the decision and from evidence about what stable and materially different batches look like. The illustrative cost of one does not tell anyone whether to close a fixture, adjust a rail, or accept a shipment. These actions could depend on tail exceedances, direction of drift, risks associated with a specific part, or other requirements not encoded by the distance. Two batches at the same distance can have very different operational consequences. Treat the metric as a descriptive number before asking whether a decision rule should be built around it.
A comparison readers can reproduce
A clear handoff begins by giving the reference population and time window. State whether the comparison uses rows, specimens, or pooled groups, and say what the weights mean. Provide the measurement unit and fixed origin, and describe any transformations. If the work is about anonymous distributions, say so explicitly rather than avoiding the question of identity. A reader can then recognize when the sorted comparison makes sense and when individual matching would answer a different problem more directly.
Next give a compact arithmetic check. The exact-reference comparison must cost zero. The inward toy produces one because both halves move one unit. A pure common shift produces the shift's magnitude. Reversing the order of rows should not alter a distribution comparison, while changing the allocated weights can. Reporting these fixtures is more informative than saying which software was used without naming its inputs. It makes it possible to identify an accidental unnormalized calculation, mislabeled unit, or pairing-by-row shortcut during a later review.
Include at least one directional or shape view when readers need to know what moved. A shared-axis empirical cumulative plot can show where the gaps occur. A graph of the raw positions for small lists can show the collapse toward the midpoint more directly. A mean and a robust spread summary can help describe which properties stayed stable or changed. These accompanying views need not compete with the distance. They explain why it took the value it did, and why another arrangement could take the same value without looking the same.
When comparing successive periods, avoid quietly changing the reference midway. A stationary reference answers how current arrangements differ from a common starting point. A rolling reference may be useful for detecting short changes while forgetting older differences. For example, many tiny shifts can add up to a substantial displacement from the original tray but look ordinary compared with the immediately preceding one. A label such as “distance from reference” is incomplete unless the identity of that reference is recoverable. If both views are reported, name each clearly rather than merging their values.
An archived report can also distinguish repairs from changes worth interpreting. If an earlier dataset included accidental repeated rows, a corrected distance may move even though none of the positions changed in the actual fixture. If a later set was converted to the same ruler, an apparent shift might disappear. Retaining a short history of the corrections stabilizes the meaning of the reported comparison. A reviewer should be able to tell whether the change occurred in the observed population or in the handling of the observations.
Distinguish absolute cost from a convenient normalized index
Some dashboards try to turn every quantity into an index from zero to one. The first Wasserstein distance already uses probabilities to normalize total mass, but it has not normalized the ruler. Its possible range can grow as support on the line extends, and its units remain those of position. On a rail of known finite length, one could divide by that length to define a dimensionless index if a relative measure fits the reporting goal. But that extra step changes what a numeric value means and can hide a physical shift when rails have different lengths. Specify the length denominator if such an index is shown.
When two instruments operate on nominally identical rails, their coordinate systems still need verification. Assume one uses the center as zero and another uses the left stop. If the exported records are compared without adjusting the origin, an apparent common translation can dominate the cost. That looks like a meaningful departure because a pure shift produces a clean number. Checking enough shared landmarks can reveal that no comparable shift in placement was actually measured. The transport calculation is precise only about the inputs it received; it cannot diagnose reference-axis errors from the distance alone.
Precision and accuracy do not become interchangeable through repeated observations. If one measuring system consistently has a small bias, repeating readings can make its batch distribution look quite stable while leaving it displaced from a better calibrated reference. A comparison may be good evidence of a difference between measurement systems without identifying which is right. In contrast, ordinary sampling variation among parts can produce a nonzero empirical distance even when both instruments are sound. A conclusion about the source of the departure needs supporting checks that distinguish properties of the instrument from properties of the measured population.
Finally, consider one table used by two teams. For inventory staff the main question might be whether ten pieces are missing, so normalized positions alone are inadequate. For engineers the question might be whether the remaining stock occupies the same part of the rail, so relative masses are relevant. A single pair of measurements can serve both uses if the report shows stock totals and the position distribution separately. Let the different denominators stay visible rather than making one measure stand in for the other.
A concise review can ask someone else to recompute the chart from the few listed coordinates and to explain why the units are position units. Then ask where the chart contains the count of actual pieces moved. The correct answer is that it does not determine it. Reproducing the two scalar values checks the arithmetic; explaining what they leave undisclosed checks the measurement contract. Either step can uncover a mistake that the other misses.
The two trays are useful because the contradiction is easy to see. They share a center, and still every part of normalized mass in the example must change position in an optimal rearrangement. The distance gives that anonymous movement a unit. It does not identify who moved, specify the cause, or make a decision for the person watching the rail. With a shared ruler, explicit weights, and a named reference, the number says exactly enough to answer the distribution question without pretending to answer the others.
If the design calls for reporting change over time, that last distinction suggests a practical pairing: give anonymous distribution distance for each batch and a separate trajectory summary only for items that actually have reliable identities. An incomplete identity log should not be filled in with optimal matches and then presented as observed movement. The hypothetical plan can supply a lower bound under its own weighting assumptions, but not the missing histories.