Chapter 6. Classification, the classifier as an observer

Data Mining as Observation, draft 0.3, 2026-09-09. Week 6 of ECE 514. Reading due before this chapter is TSK 3.1 to 3.4 and 4.3 to 4.4 [1]. Section 0.14 of the toolkit introduces the classifier vocabulary this chapter uses. Every number below traces to a committed file listed in the last section.

A classifier is the first consumer this course builds rather than borrows. Every earlier chapter treated the reader as given. This one constructs it, and the construction makes the book's idea concrete in a way no borrowed reader can. A classifier has a score, a threshold, and a decision. The score is a function of the input. Its sensitivity to each direction of the input is measurable. The directions it reads are its read subspace, and the directions it ignores are its nuisance, and both can be computed before the classifier is ever evaluated.

The standard treatment covers decision trees, overfitting and model selection, nearest neighbours, and naive Bayes. This chapter adds three things. It writes each of those methods as an observer and says what each reads. It shows the read subspace of a trained classifier being measured from outside, on a planted case where it worked and a real case where it missed its bar. And it takes up the question the session deck asks in its own words, do you need a black box or would a formula suffice, with a tool the author built to answer it and the correction that tool's own claims required.

6.1 A classifier is a consumer with a threshold

Write the classifier as an observer triple. The consumer is the score function. The output metric is whatever scores its mistakes, accuracy, F1, calibrated log-loss, or a cost matrix. None of those is a local geometry on the score, so a classifier's read operator is the operator of its score with the identity geometry, and the metric decides the threshold and the price of each mistake. The budget is the number of training rows and the model's capacity.

Each of the week's methods has a read subspace that can be named without any measurement.

A linear classifier, logistic regression or a linear support vector machine, scores by a weighted sum. Its score moves only along its weight vector, so its read subspace is one direction and its nuisance is everything orthogonal. Section 0.5's arithmetic gives the read operator as the outer product of the weight vector with itself, scaled by how steep the score is at each row.

$$s(x)=w\cdot x+b,\qquad P_C=\mathbb E\big[\sigma'(s)^{2}\big]\,w\,w^{\top},\qquad \operatorname{rank}P_C=1. \tag{6.1}$$

That this operator sends every vector to a multiple of the weights and reads nothing orthogonal to them, that the boundary is crossed exactly once along the weights and never orthogonally, and that a perturbation smaller than the margin over the weight length cannot change the decision, are machine-checked in Lean in appendix C.

The read subspace of a linear classifier is one directiondecision boundaryw, the read directionnuisance, along the boundaryscore s = w . x + bread operatorproportional to w w^Trank one
Figure 6.1. A linear classifier reads one direction. Its score moves only along the weight vector, so its read subspace is that line and everything orthogonal to the boundary is nuisance.

A decision tree scores by a sequence of axis-aligned splits. Its read subspace is spanned by the coordinate axes it splits on, and a feature that appears in no split is in its nuisance exactly. Within a leaf the score is flat, so the tree's sensitivity is zero almost everywhere and concentrated at the split boundaries. That is the property section 2.3 called a selection consumer, and it is why a finite-difference probe of a tree returns zero at most rows and why tree importances, which count splits, are the right sensitivity for this reader.

A nearest-neighbour classifier reads whatever the distance function reads. Chapter 3 said a distance is a choice of what to ignore. Under Euclidean distance the classifier reads every standardized coordinate equally. Under cosine it reads the angle. The classifier inherits the distance's quotient, and the session's week-three choice returns here as the whole of the model.

Naive Bayes reads each feature through its own one-dimensional likelihood and adds the logs. Its score is additive across features, so it has no interaction terms. A change in one feature moves the score by the same amount whatever the other features are, which is a statement about cross-partials, the Hessian of the score, and that matrix is diagonal. Its read operator is not diagonal in general, because two features' sensitivities can rise and fall together across rows even when neither changes the other's effect. What naive Bayes cannot read is the interaction. That is a limit of the model class rather than a direction in its kernel, and it is also its speed.

That raising the threshold can only shrink the predicted set, so that true and false positives can only fall, and that a monotone recalibration of score and threshold together changes no decision, are machine-checked in Lean in appendix C.

That a stump is flat on either side of its split and reads nothing of the coordinates it does not split on, that the sigmoid is strictly increasing so the decision at one half is the sign of the weighted sum, and that a naive Bayes score is additive across features, are machine-checked in Lean in appendix C.

That a strictly increasing transform of the distance names the same nearest neighbours, so the nearest-neighbour classifier reads the distance's order and nothing else, is machine-checked in Lean in appendix C.

The output metric matters as much as the consumer, and the observation program's ledger has the receipt. A classifier scored by accuracy and the same classifier scored by calibrated log-loss are different observers, because they weigh the same mistakes differently, and the same compression of their inputs can get opposite verdicts from the two. Naming the output metric is naming what a downstream mistake is, and chapter 8 section 8.2 showed what a metric that is not the consumer's does at the harness. Here the point is one step earlier. The metric is part of the classifier's definition, and a classification report that gives a score without saying which metric the threshold was tuned for has left the observer half named.

6.2 What the classifier reads can be measured from outside

For a linear classifier the read subspace is the weight vector and no measurement is needed. For a trained model with no closed form, a boosted ensemble, a neural network, a scoring service behind an interface, the read subspace has to be measured. Section 0.5 gave the method. Perturb each input coordinate, watch the score move, average the outer product of the resulting sensitivities over rows. Chapter 11 section 11.7 gives the price, two calls per input dimension per row, and says why nothing cheaper works at one operating point for a probe confined to the directions it chooses, which is the case the theorem covers.

The planted case. The observation program's first sealed test of that probe planted a low-rank read subspace [13] inside a smooth consumer and asked the probe to find it seeing only the consumer's outputs. It recovered the subspace at overlap 0.936 against a chance level of 0.059, about sixteen times chance, and its blind statistic predicted which of two compressions the consumer would prefer twelve times of twelve, while reconstruction error could not, at 0.40. The prediction was sealed before the run and passed five of five bars.

The real case, which missed. The same probe was then pointed at a trained three-billion-parameter language model's attention, with a sealed bar of 0.60 overlap. It recovered the real read operator at a median overlap of 0.567, about 4.5 times chance, with two heads above 0.8, and missed the bar. The registered pair of compressions was also not matched on reconstruction, so the second sealed trigger, that the blind statistic beats reconstruction at predicting the winner, could not fire, because both predicted it sixteen times of sixteen. Two of three triggers missed and the row is carried as refuted. A later, better designed rematch with reconstruction-matched arms passed four of four, and the ledger's sentence is that clearing a later bar does not erase the earlier miss. The first sealed real-model design was flawed, and the record says so at the prominence of the later pass.

A classifier as the consumer of a compressor. The clearest data-mining instance of the read subspace at work is a classifier reading compressed inputs. On 8718 sperm-whale codas, a clan classifier read rhythm features compressed two ways at matched bits. The code that preserved what the classifier reads reached held-out AUROC 0.934. The reconstruction-optimal code reached 0.883 while reconstructing the codas twice as well. The anti arm was worst 300 times of 300. That row was promoted from a one-metric verdict to a sealed flip, and it is the whale row of chapter 4's table. For this chapter the point is that the classifier's read subspace, not the data's variance, decided which compression was safe.

For a course project the operational reading is one paragraph. Estimate your classifier's read operator at the full budget. Report the three features it reads most and the three it ignores. Then compare that list to the features your cleaning and reduction steps protected. Chapter 4 said what happens when they disagree.

6.3 Do you need a black box, or would a formula suffice

The session deck's opener for the week asks whether a black box is needed. The author built a tool to answer that question on a given dataset [23], and this section describes what it does and what it found. The next section describes what was wrong with how it first reported it.

The search. The tool enumerates formula trees over the features to a depth of three, expressions such as the smaller of two features plus a third, using ten binary and eight unary operations. Each formula is a score. Its optimal thresholded F1 is found exactly by sorting the rows by score and sweeping every distinct value as a threshold, in both directions, which costs one sort per formula. A beam keeps the best formulas at each depth. Projections, principal or partial-least-squares components, are added as extra features so that a depth-three formula has implicit access to all the columns.

The theorem that prunes the search. A strictly monotone transform of a score, its logarithm, square root, exponential, or negation, cannot change its optimal thresholded F1. The proof is one line. If the transform is increasing, the score exceeds a threshold exactly when the untransformed score exceeds the transformed threshold, and if it is decreasing the same holds with the direction reversed, so the set of achievable thresholded predictors over both directions is identical. Section 0.8 said F1 and AUROC depend on the ranking alone. This theorem is that sentence made into a pruning rule. Every monotone unary node in the search tree can be skipped without loss. A second, learned pruning rule, discovered from exhaustive fold-local search, removed 88 to 99.6 percent of dead subtrees with zero false negatives on the datasets tested.

$$\begin{gathered} \max_{\tau,\ \mathrm{dir}}F_1\!\Big(\mathbf 1\big[\mathrm{dir}\big(g(f(X)),\tau\big)\big],\,y\Big)=\max_{\tau,\ \mathrm{dir}}F_1\!\Big(\mathbf 1\big[\mathrm{dir}\big(f(X),\tau\big)\big],\,y\Big) \\ \text{for every strictly monotone } g. \end{gathered} \tag{6.2}$$

The theorem, for AUROC and for optimal thresholded F1 in both threshold directions, is machine-checked in Lean in appendix C.

Same rows, same order, same partitions under a monotone transform00.250.50.751scorescore 0.1, label 0score 0.3, label 0score 0.4, label 1score 0.6, label 0score 0.8, label 1score 0.9, label 1threshold, F1 0.857-2.5-2-1.5-1-0.50log of scorelog of score -2.303, label 0log of score -1.204, label 0log of score -0.916, label 1log of score -0.511, label 0log of score -0.223, label 1log of score -0.105, label 1threshold, F1 0.857label 0label 1
Figure 6.2. The Monotone Invariance Theorem on six rows. A logarithm preserves the order of the scores, so every threshold partition is still available and the optimal thresholded F1 stays 0.857.

Fair evaluation. The formula is discovered on the training fold, its threshold is tuned on the training fold, and it is scored on the test fold. The baselines, gradient boosting, random forest, and logistic regression, get the identical protocol. Two hundred repetitions of five-fold cross-validation give a thousand paired measurements per dataset.

What it found, on the five datasets in the tool's record.

datasetrowsfeaturesformulatest F1against gradient boosting
diabetes7688the smaller of insulin and age, plus glucose0.668formula wins
wine17813the smaller of two features plus a third0.953formula wins
banknote13724sum of three features0.986boosting wins
breast cancer56930a feature minus a principal component plus a feature0.963boosting wins narrowly
EEG1498014the larger of a difference and a feature0.655boosting wins decisively

The pattern the record draws is that when the boundary can be captured by two or three features a formula matches or beats the ensemble, and when it needs many, the ensemble wins. On breast cancer, adding principal components closed most of the distance, from 0.955 to 0.963. On EEG nothing closed it. The tool's value is in the comparison rather than in winning, and its record reports the losses at the same size as the wins.

For a project the question is asked in the tool's terms. Fit the formula search and the ensemble under the identical fold protocol, report both, and report the difference with an interval. If the formula is within the interval of the ensemble, the project has a consumer a human can read. If it is not, the project has learned what the data needs that three features cannot say.

6.4 The confidence column was wrong, and the record says so

The tool's record originally reported its comparisons in a column headed sigma, with entries like 25 sigma on the diabetes row. Chapter 8 section 8.5 told the arithmetic of what went wrong. This section tells it as the author of the tool.

The sigma was an uncorrected one-sample t statistic on the thousand per-fold differences, stored as if the folds were independent. They share training data. Under the correction of section 8.5 the variance inflates by 251 [4] at a thousand folds with a test-to-train ratio of one quarter, and the standard error by 15.8. An independent check that recomputed every threshold from the printed intervals [25] without reusing the tool's own script found that of nine wins across a larger 31-dataset run, three survive the full correction, seven survive half of it, and eight survive a third. The record becomes three wins, seventeen ties, and eleven losses. The same check found the manuscript said three incompatible things about the same interval, declining it as inferential in the methods, using it as the win criterion in the table, and calling it significance in the results.

A reviewer of the manuscript, independently, wrote the revision plan the record now carries. Drop the sigma notation everywhere and report the mean difference in F1 with a 95 percent interval and a corrected resampled t statistic. Replace every instance of "any tabular dataset" with the bounded claim the evidence supports, that within a depth-three formula class for binary tabular classification, under the specified protocol, the method determines whether simple formulas are competitive. And rerun the eleven datasets that had been evaluated under a different protocol, twenty repetitions against random forest rather than two hundred against gradient boosting, so that the pooled counts are comparable. That rerun was in progress when this chapter was written.

Five further analyses asked whether the seventeen ties could be resolved from the data already collected. All five said no, because the corrected standard error sat within 0.2 percent of its floor, and heterogeneity between datasets was twelve times the practical-equivalence band. The experiment that would resolve them measures a learning curve within each dataset, training at a grid of subsample sizes, so that each dataset becomes its own control and the size effect is estimated where the heterogeneity cancels rather than where it dominates.

The five-dataset table in section 6.3 stands. Its F1 values are held-out means and do not depend on the correction. What changed is the confidence attached to the comparison column, and this chapter reports that column as wins and losses without a number attached, because the number the record carried was not one the folds could support. The tool's record now says the same.

6.5 Interpretability is a budget question

A formula is a consumer a human can read. An ensemble of five hundred trees is not. The session deck lists interpretability as the difference between selection and extraction, and this chapter states it as the book would. There are two readers of a classifier, the machine that acts on its scores and the person who has to trust it, and they have different budgets. The person's budget is a few features and a few operations. When the data's boundary fits inside that budget, the formula is the better observer for the person and no worse for the machine. When it does not, the ensemble is the better observer for the machine and the person is left with importances, which are a proxy for the read operator and not the read operator.

The tool's projections make the trade visible. A formula on principal components has implicit access to all the columns and loses the property that a person can read it, because a component is a weighted sum of everything. The reviewer's revision plan asks for the loading weights of every projected component in every winning formula, and for their stability across folds, so that a formula written on a projection can be judged as an interpretable object rather than assumed to be one. That is the right question and it is the reader's question. Which reader, at what budget.

6.6 What a classification report must state

A project report that trains a classifier states the following beside its headline.

A report that compares two classifiers by a sigma count on cross-validation folds will be returned with section 8.5.

Exercises

Warm-up

  1. Write the observer triple for a decision tree, a nearest-neighbour classifier, and naive Bayes, naming what each reads and what each ignores.
  2. Why does a finite-difference probe of a decision tree return zero at most rows, and what is the right sensitivity for that reader?
  3. Explain why the same classifier under accuracy and under calibrated log-loss counts as two observers.
  4. State the Monotone Invariance Theorem in your own words and give one transform it covers and one it does not.
  5. Why does the fair evaluation protocol tune the threshold on the training fold rather than the test fold?
  6. On the real-model probe, two of three sealed triggers missed. Name both and say why the second could not fire.
  7. Why does a later pass not erase an earlier sealed miss?
  8. State the pattern the five-dataset table draws, and name the dataset that comes closest to breaking it.
  9. Why is a formula on principal components not interpretable in the sense a formula on raw features is?
  10. What replaced the sigma column in the tool's record, and why?

By hand

  1. A classifier at its chosen threshold makes 30 true positives, 10 false positives, and 20 false negatives. Compute precision, recall, and F1.
  2. Six rows have scores 0.1, 0.3, 0.4, 0.6, 0.8, 0.9 and labels 0, 0, 1, 0, 1, 1. Sweep the threshold over the intervals between consecutive scores and report the optimal thresholded F1 and the threshold that achieves it.
  3. Apply the transform log to the scores of exercise 12 and repeat the sweep. State whether the optimal F1 changed and why. Then apply negation and state what changed.
  4. A logistic classifier has weight vector (3, negative 1) and every row sits exactly at probability 0.5. Its score's sensitivity at a row is the probability times one minus the probability times the weight vector. Write the read operator and state its rank and its read subspace.
  5. A comparison uses 20 repetitions of 5-fold cross-validation with a test-to-train ratio of one quarter. Compute the Nadeau-Bengio variance inflation and standard-error inflation. A reported 10 sigma becomes how many corrected standard errors?
  6. With 8 features and 10 binary operations, count the distinct depth-two formulas of the form one operation applied to two features, treating the order of the two features as significant.

Programming

  1. Train logistic regression, a decision tree, and gradient boosting on your project dataset under one fold protocol. Report F1, the threshold, and the decision each threshold serves.
  2. Estimate the read operator of each trained model by finite differences at twice the feature count of calls per row, following section 0.5. For the tree, report the split features instead and explain why. Report the three most and three least read features for each model.
  3. Install the formula-search tool and run it on your dataset under the same fold protocol as exercise 17. Report the best depth-three formula, its held-out F1, and the difference from gradient boosting with a paired-bootstrap interval.
  4. Apply the Nadeau-Bengio correction to that difference and report the corrected interval beside the uncorrected one.
  5. Verify the Monotone Invariance Theorem numerically. Take the winning formula, apply five monotone transforms, and report the optimal thresholded F1 of each.
  6. Compress your dataset's features two ways at matched bits, one by variance and one against the classifier's read operator, retrain the classifier on each, and report held-out F1 for both and for an arm that destroys the read direction.
  7. Subsample your dataset at five sizes and repeat exercise 19 at each. Plot the formula-minus-ensemble difference against log sample size and report its slope.

Answers to the warm-up and by-hand problems are collected in the answer key at the end of the book.

Homework 6. Formula or black box

Assigned in week 6, due Sunday of week 7. Twenty points. Uses your project dataset.

Part A, three observers (4 points). Programming exercises 17 and 18. The F1 table and the read-subspace table, with call counts. A read operator estimated below twice the feature count earns zero for this part.

Part B, the formula (6 points). Programming exercises 19 and 20. The formula, its F1, and the difference from gradient boosting with both intervals side by side. State in one sentence whether your data needs a black box.

Part C, the theorem (3 points). Programming exercise 21. Five transforms, five F1 values, one sentence.

Part D, the reader decides the compression (5 points). Programming exercise 22. Three arms, three F1 values, and whether the read-aligned compression beat the variance compression at matched bits.

Part E, the statement (2 points). The six items of section 6.6 for your classifier.

Preregistration. Before Part B, commit a file stating whether you expect a depth-three formula to fall inside the ensemble's interval. 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.

SectionClaimSource
6.1the classifier row of the consumer table, the output metric makes a different observergeometric-observation\chapters\ch04_the_observer_triple.md:60-135
6.1selection consumers have zero sensitivity almost everywherereadscope\readscope\regimes.py:1-60
6.2planted probe, overlap 0.936 vs 0.059, twelve of twelve, reconstruction 0.40, five of fivegeometric-observation\claims\LEDGER.md row GO-1
6.2real model, median 0.567 vs bar 0.60, about 4.5 times chance, heads at 0.815 and 0.958, sixteen of sixteen both, two of three triggers, NEG-12, later rematch four of fourgeometric-observation\claims\LEDGER.md rows GO-B-Llama and NEG-12; geometric-observation\chapters\ch16_honest_negatives.md:73-81
6.2whale clan classifier, 8718 codas, 0.934 vs 0.883, reconstructs twice as well, 300 of 300geometric-observation\chapters\ch08_value.md:40-70; geometric-observation\claims\LEDGER.md row 038
6.3depth three, ten binary and eight unary operations, exact optimal F1 by sort and sweep, beam, projectionstheory-radar\README.md:50-100,140-200
6.3Monotone Invariance Theorem and its prooftheory-radar\paper\theory_radar_paper.tex:290-304; theory-radar\paper\astar_paper.tex:94-110
6.388 to 99.6 percent pruned with zero false negatives, fair protocol, 200 by 5 foldstheory-radar\README.md:88-100
6.3the five-dataset table, breast cancer 0.955 to 0.963, the pattern, DOI 10.5281/zenodo.20660206theory-radar\README.md:100-140
6.4the uncorrected t stored as sigma, 251 and 15.84, nine wins to three, seven, eight, 3 wins 17 ties 11 losses on 31 datasets, the three-way inconsistencyconstraint-gap\review\FINDINGS.md:1-35; constraint-gap\README.md:57-76
6.4the reviewer's revision plan, drop sigma, bounded claim, 19 at 200 by 5 vs 11 at 20 by 5, rerun in progresstheory-radar\paper\REVISION_PLAN.md:1-60
6.4five analyses negative, 0.2 percent of floor, twelve times the band, learning-curve redesignconstraint-gap\README.md:57-76; constraint-gap\review\REDESIGN.md:1-45
6.5loading weights and stability across folds requestedtheory-radar\paper\REVISION_PLAN.md issue 6

previous, Chapter 5. Frequent patterns and safe pruning  ยท  next, Chapter 7. Ensembles and boosting