Chapter 2. Data, measurement, and what an observer can read
Data Mining as Observation, draft 0.3, 2026-09-09. Week 2 of ECE 514. Reading due before this chapter is TSK 2.1 to 2.3 [1], with 2.3.4 to 2.3.7 reread before the second session. Every number below traces to a committed file listed in the last section.
Cleaning dominates the calendar of every data-mining project, and the session deck says why in its opener. This chapter says something the deck does not. Every cleaning step is a decision about what the consumer will be allowed to see.
A measurement scale declares which transformations of a column do not change its meaning. An imputation writes a value into a cell the consumer will read. A standardization rescales a direction the consumer may or may not care about. A discretization collapses an ordered quantity to a few labels. Each is a change to the data's quotient, in the sense of section 0.6, made before anyone has said who reads the result. The chapter takes the standard cleaning toolkit in TSK's order and asks, at each step, what the reader loses and what the reader gains. It then collects three measured cases in which a correction that looked like cleaning was something else.
2.1 A measurement scale is a statement about what the reader may ignore
TSK sorts attributes into four types by the operations that make sense on them. Nominal attributes support equality only. Ordinal attributes add order. Interval attributes add differences. Ratio attributes add ratios, because they have a true zero. Each type comes with the transformations that preserve its meaning. Any one-to-one relabelling of a nominal attribute, any order-preserving map of an ordinal one, any shift and positive scale of an interval one, any positive scale of a ratio one.
Read through the observer, a scale is a declaration about the consumer. It says which transformations of the column the consumer's output must not respond to. A consumer that reads a nominal code as if the code's numeric value meant something has a read subspace that includes a direction the scale declared meaningless. That is the deck's sentence about type errors poisoning everything downstream, stated as an operator. The error is not in the data. It is in a reader that reads a direction the data never carried.
That the four scales' permitted transformations are nested, a rescaling being affine, an affine map with positive slope strictly increasing, and a strictly increasing map injective, and that a rescaling preserves ratios while an affine map preserves ratios of differences, are machine-checked in Lean in appendix C.
The four types are four quotients of increasing fineness. The nominal quotient identifies all relabellings. The ratio quotient identifies only rescalings. A consumer is well matched to a column when its nuisance, the set of directions its output ignores, contains the column's permitted transformations. A consumer is mismatched when it reads one of them. Chapter 3 will make the same point about distance functions, which are consumers of pairs of rows, and chapter 11 has the measured case in which a reader that reads per-coordinate scale was fed a column whose scale had been normalized away.
2.2 The read operator, for this chapter
Section 0.5 defined the read operator as the average, over rows, of the outer product of the consumer's sensitivity. Four facts from that definition are used in this chapter and every later one, and they are stated here in words.
The read subspace is small. A linear binary classifier reads one direction, its weight vector, and any scalar-output consumer reads one direction at each row. An attention head reads a handful. An estimator of a single angle reads one. The input has hundreds or thousands of coordinates. The distance between those two numbers is the whole opportunity of the book. It is the room in which a cleaning step, a reduction, or a code can be terrible by the identity reader's yardstick and excellent for the consumer.
The operator is local. For a linear consumer the sensitivity is the same everywhere. For a nonlinear one it changes from row to row, and every result that respects this carries the read operator as a field over the data rather than a constant, P_C(x) at each row. The average over the data is what enters the alignment measure of chapter 4, and it is the average whose kernel the book calls the nuisance. Because each local operator is positive semidefinite, that kernel is the set of directions unread at almost every row of the workload, for a nonlinear consumer as much as for a linear one. What it is not, for a nonlinear consumer, is a global equivalence of inputs, since a direction that is null at every row can still turn with the row, as the radial direction does for cosine similarity, and section 0.6 keeps the three notions apart.
Pipelines compose, pointwise. A consumer that is a chain of stages, standardize then impute then reduce then classify, has at each row a read operator equal to the last stage's pointwise read operator pulled back through the Jacobians of the earlier stages at that row. Rank cannot increase under that pullback, so at each row a scalar-output classifier at the end forces the pointwise read subspace of the whole pipeline to one direction, however many columns the cleaning stages touched. The averaged operator obeys no such bound. The consumer $C(x)=x_1^2+x_2^2$ has a rank-one pointwise operator at every row and, on isotropic data of unit variance, an average of four times the identity, which has rank two. Every rank statement in this book is pointwise unless it says otherwise, and every cleaning step in this chapter is a stage in that chain.
$$P_{C_2\circ C_1}(x)=J_1(x)^{\top}\,P_{C_2}\big(C_1(x)\big)\,J_1(x),\qquad \operatorname{rank}P_{C_2\circ C_1}(x)\le\operatorname{rank}P_{C_2}\big(C_1(x)\big)\quad\text{at each row } x. \tag{2.1}$$
The read distortion is not a complete ranking. The error's variance weighted by the read operator governs the comparison the theory is about, and chapter 4 shows it predicting a downstream flip twelve times of twelve. On the same data it misordered one middle pair of codes whose per-row error had structure across rows that the weighted variance does not see. The mechanism is real. The single number summarizing it is not exhaustive, and the ledger carries that as a refuted claim about completeness beside the demonstrated claim about control.
2.3 The mechanism decides the fix, and the fix is a claim
The core claim of the week is that the missingness mechanism decides the remedy. Missing completely at random, where the probability of a hole is unrelated to anything, permits deletion. Missing at random, where the probability depends on observed columns, permits imputation conditioned on those columns. Missing not at random, where the probability depends on the missing value itself, permits neither without a model of the mechanism, and the deck's example is a salary field that high earners decline to fill in.
The observer reading adds two things.
An imputed value is a value the consumer will read. Deletion removes a row from every reader. Imputation writes a number into a cell, and that cell lies in some direction of the input. If the direction is in the consumer's nuisance, the imputed value costs nothing and the choice among methods does not matter. If it is in the read subspace, the consumer's output moves by the imputed value's error times the consumer's sensitivity, and the choice among methods is a choice of error placed where the consumer looks. The deck's rule, that the mechanism decides the fix, has a companion. The consumer decides how much the fix costs.
$$\Delta C\approx g\cdot\delta_{\mathrm{imp}},\qquad \mathbb E\big[\Delta C^{2}\big]\approx\operatorname{tr}\big(P_C\,\Sigma_{\mathrm{imp}}\big). \tag{2.2}$$
Imputing before splitting is leakage. An imputer fit on all rows has read the rows that will later be test rows. Chapter 8 states this in the general form. The evaluation harness acquires a read direction the deployed consumer will not have, and every number it reports is about the harness. The fix is the one the deck gives. Fit the imputer inside the fold.
A missing-data rule is written before the holes appear. The preregistration template that the observation campaigns use has a required field for it [14], and the field's text is one sentence. Every trajectory receives an outcome. State how numerical failure, timeout, escape, no-fold, and recrossing are counted. The data-mining translation is that every row receives an outcome, and how a null, a parse failure, a sentinel, a duplicate, and an out-of-range value are counted is decided and committed before the first row is inspected. A rule decided after inspection is a rule fit to the data.
That mean imputation leaves the mean unchanged and shrinks the variance is machine-checked in Lean in appendix C.
An instrument that cannot measure should refuse. The measurement instrument of chapter 11 carries a module whose only purpose is to say when its own reading is worthless [15]. A consumer that reads the order of its inputs rather than their values, such as a top-k selector, has zero sensitivity almost everywhere, and a probe pointed at it returns a confident reading that the consumer reads nothing. A consumer with a recurrence has a sensitivity that compounds along the sequence, and a single-step probe sees none of it. The module names the cases and raises rather than reporting. A cleaning pipeline needs the same module. A column whose mechanism cannot be determined, a join whose key is ambiguous, a sensor whose range is exceeded, each should produce a flag and a count rather than a silently filled value.
2.4 A correction can be the wrong shape
Two attempts to turn a measured effect into a correction, both in the calibration of that same instrument [15], are the chapter's failure cases, and they are here because a cleaning step is a correction.
The reading nobody questioned. The first attempt estimated a quantity called loading from the sixteen operating points the probe had visited, in a 128-dimensional space. A covariance fit from sixteen points in 128 dimensions has rank fifteen. The regularizer dominated its log determinant, and the divergence came back near ten to the eleventh nats. No bar was tested, because the run was stopped once the readings were seen to be degenerate. The record's sentence is the chapter's. An instrument that reports ten to the eleventh without complaint is worse than one that stops. The instrument now refuses when the sample count does not exceed the dimension and warns below five samples per dimension. The conceptual error underneath was that loading is a property of two distributions, not of the sample a probe happens to visit, and conflating them tied the estimate's quality to a budget that had nothing to do with it.
The correction that passed by clipping. The second attempt estimated loading properly, from 1024 draws per distribution, fit a correction, and reported a 92.1 percent reduction in mean absolute error, passing all six bars including the one designed to falsify it. It was not a result. The correction had been fit over readings between 0.89 and 91.64 nats. In the test, only 15 percent of readings fell inside that range, and the maximum was 1.9 times ten to the twelfth. Outside the range the correction clamped to its endpoint, so every reading was divided by the same constant, and 202 of 240 corrected values came out at exactly 1.0, pinned by an output clip. The truth being compared against was also 1.0. The correction predicted nothing. It divided by a constant and the clip did the rest. The bar passed for a reason unrelated to the correction working. The correction now refuses to extrapolate by default, and the specification's verdict is that loading is reported as a warning and not applied as a correction, because a scalar correction is the wrong shape for a structured error.
The data-mining twin is any global fix applied to a structured problem. A single imputed constant for a column whose holes depend on another column. A single scale factor for a sensor whose drift depends on temperature. A single outlier threshold for a distribution with two modes. Each is a correction of one number's shape applied to an error with more structure than one number, and each will pass a test that only checks the one number.
2.5 Invertible transforms change the geometry, and discretization changes the quotient
The second session covers scaling, power transforms, discretization, and sampling, and asks when not to standardize. The observer answer is direct.
Standardization divides each column by its spread. It is invertible, so it discards nothing, and what it changes is the reader rather than the data. An invertible transform identifies no two rows, so it forms no quotient. It changes the coordinates, and a Euclidean distance computed after it is a different metric on the same rows, one that has declared the original scale irrelevant. It changes the geometry the reader sees, not what the table holds and not which rows count as the same. For a consumer that reads distances across columns, the Euclidean reader of chapter 3, that declaration is almost always right, because otherwise the column with the largest units decides every distance. For a consumer that reads a column's scale as information, it is wrong, and chapter 11 has the measured case. A quantizer that normalized each vector to unit length, discarding per-coordinate scale, read cosine similarity 0.995 against the original while the consumer that read those vectors, a softmax over dot products, was broken by three orders of magnitude. The scale it deleted was the direction the reader read. Standardize when the consumer's nuisance contains scale. Do not when its read subspace does.
Whitening, section 0.4, goes one step further and removes correlation between columns as well as scale. Chapter 4 shows that a code which whitens before allocating bits wins at every budget on one dataset, because whitening aligns the code's error with the consumer's read operator. Full-rank whitening is an invertible change of coordinates, not a quotient. It is the right geometry for a reader whose sensitivity is spread across correlated columns and the wrong one for a reader whose sensitivity is aligned with the original axes.
Logarithms and power transforms are invertible as well, and they change which differences the consumer sees as equal. A log makes a doubling the same size everywhere. For a consumer that reads ratios, that is the right quotient. For one that reads differences, it is not.
Discretization is the one operation in this section that discards information. It collapses an ordered quantity to a few bins, and the deck's three choices, equal width, equal frequency, and supervised, are three quotients. Equal width identifies values by absolute position. Equal frequency identifies them by rank. Supervised discretization identifies them by what the label can distinguish, which is to say it lets the consumer's read subspace choose the bins, and for that reason it must be fit inside the fold or it leaks.
That a standardized column has mean zero and variance one, that the transform is invertible, and that it preserves every ordering, are machine-checked in Lean in appendix C.
That two values in one bin of a discretization become indistinguishable, and that a sample confined to m cells has at most m labels, are machine-checked in Lean in appendix C.
The rule that unifies them is the one section 2.1 gave for scales. An invertible transform is safe for a consumer when the reader it produces still resolves the consumer's read subspace, and costly when the rescaling shrinks that subspace beneath the reader's resolution. Discretization is safe only when the values it merges differ in directions of the consumer's nuisance. A report names, for each transform, which of those it believes and why.
2.6 A number is not interpretable until it names its reference
The last cleaning step is the one nobody lists. Every reported number was computed against something, and the something is usually left implicit.
Two reasonable references, one fifth of the range apart. The measurement instrument of chapter 11 was graded, in its source program, at a subspace overlap of 0.647 [15, 13] against an attention head's read operator. A calibration recovered the same operator at resolution 1.000 at the same budget. Both could not be statements about the instrument. Reading the source program's code found the difference. The source graded against the unweighted covariance of the head's queries. The probe recovers the queries weighted by how much the softmax responds along each. Both are spanned by the queries, and they are not the same operator. Measured on 36 real cells, the two references agreed with each other at a median overlap of 0.796, ranging from 0.678 to 0.985, while the probe agreed with its own reference at 1.000 on every cell. A follow-up that matched the source's query set, 576 vectors rather than the 24 first sampled, moved the reference disagreement from 0.821 to 0.703 against the published 0.647, closing 68 percent of the distance. The published figure was the reference choice. The record's sentence is that an unweighted query covariance is a defensible account of what a head reads, and that the finding is not a correction of anyone. Two reasonable references for the same object differ by about 0.3 in overlap, so a number without its reference named is not interpretable.
The heat that was a missing mean. The vector-search benchmark of chapter 11 carried, for eleven campaigns, an anomaly it called ball-growth heat [16], in which one geometric statistic of its generated corpora ran hot against real data no matter what the generator did. Restoring the mean of the real data to the generated corpus, a centering step everyone had assumed was already in effect, fixed the statistic on eleven of twelve cells. The anomaly had been a missing preprocessing step all along. Eleven campaigns of mechanism-hunting were spent on a centering that was never applied.
For a data-mining report the rule is one line. Every number states the reference it was computed against, and every preprocessing step that a number assumes is listed beside it, so that a missing centering is found in week two and not in campaign eleven.
2.7 Sampling and aggregation are design choices
The deck closes the week by insisting that sampling and aggregation are design choices rather than conveniences, and the observer reading says what kind.
Sampling changes the budget. A verdict at one sample size does not transfer to another, and chapter 4 has the measured reversal. A sample also has an event count, and chapter 8 gives the bar below which a pass is vacuous.
Aggregation changes the quotient. Averaging rows within a group collapses every within-group direction to a point. For a consumer that reads group-level structure that is the right quotient, and for one that reads within-group structure it has deleted the read subspace. The across-row mean is exactly the direction chapter 1's consumer table says attention discards and a per-row classifier reads. Chapter 13 has the temporal version, in which a staleness rate averaged over two readers with different footprints described neither of them.
2.8 What a data section must state
A project report's data section states the following, and Lab 1 is graded against the same list.
- The scale of each attribute and the transformations it permits, with any attribute the consumer reads as a different type flagged.
- The missingness mechanism per column and the rule applied, decided and committed before the split, with the count of rows each rule touched.
- Every transform, with the consumer it serves and whether the transform's action lies in that consumer's nuisance or its read subspace.
- The reference behind every reported number, and the preprocessing each number assumes.
- The flags. Every value the pipeline could not resolve, counted rather than filled.
A data section that reports a clean table and no counts will be returned.
Exercises
Warm-up
- For each of TSK's four attribute types, name the permitted transformations and one consumer that would wrongly read one of them.
- Explain in one sentence why a type error is a property of the reader rather than of the data.
- Why can the pointwise read subspace of a long cleaning pipeline, at any row, be no larger than that of its last stage, and why does the averaged operator escape that bound?
- State the deck's rule, that the mechanism decides the fix, and the companion rule this chapter adds.
- Why must an imputer be fit inside the cross-validation fold?
- What does it mean for a cleaning pipeline to refuse rather than fill, and give one column for which refusal is right.
- Explain why the 92.1 percent error reduction in section 2.4 was not a result.
- When should a column not be standardized, in terms of the consumer's read subspace?
- Why is supervised discretization a form of leakage if fit on all rows?
- Two teams report overlaps of 0.647 and 1.000 for the same instrument on the same data. Explain how both can be correct.
- What preprocessing step had been assumed and not applied in the ball-growth anomaly, and how many campaigns did the assumption cost?
- Give one example each of a sampling choice that changes the budget and an aggregation choice that changes the quotient.
By hand
- A column records shirt size as small, medium, and large, coded 1, 2, 3. A consumer computes a weighted sum in which this column has weight 2. Compute the consumer's output change when a row moves from small to large, and state which permitted transformation of an ordinal attribute the consumer wrongly reads.
- A consumer reads the first of two coordinates with sensitivity 1 and the second with sensitivity 0. A column-mean imputation writes an error with variance 4 into the first coordinate and an error with variance 9 into the second. Compute the read distortion and the identity reader's distortion.
- Repeat exercise 14 with the sensitivities exchanged.
- A covariance is estimated from 16 rows in 128 dimensions. State its maximum possible rank and the number of directions in which it carries no information. State the instrument's refusal threshold from section 2.4 and whether this estimate would be refused.
- A correction was fit on readings between 0.89 and 91.64. In the test, 36 of 240 readings fell in that range. Compute the fraction that did and the fraction that was clamped to the endpoint.
- Two references for a read operator overlap at 0.796. A probe recovers the first at 1.000. State the overlap the probe will report against the second reference, and explain why that number says nothing about the probe.
- A dataset of 5000 rows has a column with 12 percent of values missing. Under deletion, compute the rows remaining. Under imputation, compute the number of cells whose values the consumer will read that were written by the imputer.
Programming
- Take your project dataset. For each column, state its TSK type, then write a one-line test that fails if a permitted transformation of that column changes your consumer's output. Report which columns fail.
- For each column with missing values, tabulate the missingness against every other column and state the mechanism you infer. Commit your per-column rule before running any imputation.
- Implement column-mean imputation fit on all rows and fit inside each fold. Report the cross-validated score under each, and the difference.
- Estimate your consumer's read operator by finite differences at a budget of twice the column count, following section 0.5. For each imputed column, report the consumer's sensitivity to it. State which imputations the consumer can feel.
- Fit a scalar correction, a single multiplicative factor, to a column with a known structured drift, and evaluate it on a held-out range. Report the fraction of held-out values outside the fit range and the error on those values alone.
- Standardize your dataset, then compute your consumer's output before and after. Report the columns for which the output changed most. State whether standardization was in the consumer's nuisance.
- Choose one reported number from your Lab 1 submission. Name its reference and every preprocessing step it assumes. Recompute it with one assumed step removed and report the change.
Answers to the warm-up and by-hand problems are collected in the answer key at the end of the book.
Homework 2. Clean without lying
Assigned in week 2, due Sunday of week 3. Fifteen points. Extends Lab 1 on the same dataset.
Part A, the scale audit (3 points). Programming exercise 20. The type table and the columns whose permitted transformations move the consumer.
Part B, the missing-data rule (4 points). Programming exercise 21. The mechanism table, the committed rule with its hash, and the count of rows each rule touched. A rule committed after imputation was run earns zero for this part.
Part C, inside the fold (4 points). Programming exercises 22 and 23. The two scores, their difference, and the consumer's sensitivity to each imputed column. State in one sentence which imputations the consumer can feel and which it cannot.
Part D, the reference (4 points). Programming exercise 26. The number, its reference, its assumed preprocessing, and the recomputation with one step removed.
Preregistration. Before Part C, commit a file stating which imputed columns you expect the consumer to feel. Include the hash. Graded on having been made.
Sources for every number
Paths are relative to a checkout of the named repository, at the commit and with the access status listed in appendix A, all under github.com/ahb-sjsu unless appendix A says otherwise. Shas, DOIs, and versions are as recorded in the source files on 2026-09-03. A row is reproduced by opening the cited lines at that commit, and where a row names a script the command is the one the repository's README gives for it.
| Section | Claim | Source |
|---|---|---|
| 2.1 | the four attribute types and permitted transformations | TSK 2e section 2.1 |
| 2.2 | read subspace small, operator local, pullback composition, rank cannot increase | geometric-observation\chapters\ch05_the_read_metric_and_the_quotient.md:7-48; geometric-observation\chapters\ch06_mathematical_preliminaries.md:10-27 |
| 2.2 | read distortion controls but is not a complete rank statistic, twelve of twelve, one middle pair misordered, NEG-9 | geometric-observation\chapters\ch05_the_read_metric_and_the_quotient.md:49-75 |
| 2.3 | MCAR, MAR, MNAR and the remedies, imputation before splitting | TSK 2e section 2.2; instructor working documents, not public [11], ECE_514-01_FA26_session-outlines.md:64-72 |
| 2.3 | the missing-data rule as a required preregistration field | observation-theory-campaigns\experiments\PREREG-TEMPLATE.md:47-52 |
| 2.3 | refusal regimes, selection consumers read order, recurrences compound | readscope\readscope\regimes.py:1-60 |
| 2.4 | C-7, sixteen points in 128 dimensions, rank fifteen, near ten to the eleventh nats, refuses when samples do not exceed dimension, warns below five per dimension, loading is a property of two distributions | readscope\SPEC.md:653-680 |
| 2.4 | C-7b, 92.1 percent, fit range 0.89 to 91.64, 15 percent inside, maximum 1.9e12, endpoint attenuation 0.437, 202 of 240 at 1.0, refuses to extrapolate, loading is a warning | readscope\SPEC.md:680-720; readscope\readscope\loading.py:136-219 |
| 2.5 | cosine 0.995 and the softmax reader | turboquant-pro\docs\KV_KEYS_FINDING.md:1-49 |
| 2.5 | whitened code wins at every budget | geometric-observation\chapters\ch08_value.md:84-97 |
| 2.6 | 0.647 published, 1.000 recovered, weighted vs unweighted median 0.796 range 0.678 to 0.985, probe 1.000 on every cell, 36 cells, one cell at 0.985 | readscope\SPEC.md:410-450 |
| 2.6 | C-10, 24 to 576 queries, reference rank 24 to 128, 0.821 to 0.703 vs 0.647, 68 percent of distance closed, 0.174 to 0.056, probe 1.000000 on 16 cells, residual uncontrolled | readscope\SPEC.md:450-500 |
| 2.6 | ball-growth heat a missing-mean artifact, eleven campaigns, 3 of 12 to 11 of 12 cells | openvector-bench\README.md:160-170; openvector-bench\results\RC13_VERDICT.md:1-20 |
| 2.7 | the aggregate staleness rate describing neither reader | chapter 13 of this book, section 13.3 |
previous, Chapter 1. What data mining is, and how it fails ยท next, Chapter 3. Similarity, distance, and the angle