Chapter 9. Clustering, name the manifold or certify none
Data Mining as Observation, draft 0.3, 2026-09-09. Weeks 9 and 10 of ECE 514. Reading due before this chapter is TSK 7.1 to 7.5 [1]. Section 0.15 of the toolkit introduces the clustering vocabulary this chapter uses. Every number below traces to a committed file listed in the last section.
Clustering asks whether a dataset has groups, and every clustering algorithm answers yes. K-means returns k centres whether or not the data has k groups. Hierarchical clustering returns a tree for any set of points. DBSCAN returns whatever regions clear its density threshold. The algorithms cannot say no, and that is why TSK devotes a section to validity indices, which try to say it for them.
This chapter says what a clustering is in the book's terms and then builds the instrument the algorithms lack. A clustering is a certificate that structure exists at the observer's resolution. A certificate can be right, wrong, or vacuous, and the instrument that decides which is called the recognizer. It names the shape a dataset lies on, from the dataset's own spectrum, or it certifies that it lies on none of the shapes it knows. Refusal is as important as recognition. An instrument that always names a shape is a horoscope.
9.1 A clustering is a certificate that structure exists at the observer's resolution
Write each of the week's methods as an observer. The consumer is the algorithm. The output metric is the validity index it optimizes. The budget is the sample size and the number of clusters or the density threshold.
K-means minimizes the sum of squared errors, which is total variance within clusters, which is the identity reader's distortion of chapter 4. K-means is the identity reader's clustering. It weighs every direction of the data equally, and a direction with large variance and no group structure will pull its centres exactly as chapter 4's variance-based reduction pulled its components.
$$\mathrm{SSE}=\sum_{k=1}^{K}\sum_{i\in\mathcal C_k}\|x_i-c_k\|^{2},\qquad\text{the }P_C=I\text{ distortion summed within clusters}. \tag{9.1}$$
That the error about any centre is the error about the mean plus the count times the squared distance between the two, so the mean minimizes it and nearest-centre assignment never raises the total, is machine-checked in Lean in appendix C, as are the monotone merge heights of the three linkages and that every DBSCAN reachability chain starts at a core point.
Hierarchical clustering reads whatever distance its linkage reads. Chapter 3 said a distance is a choice of what to ignore, and a dendrogram inherits that choice at every level. Single linkage reads the nearest pair. Complete linkage reads the farthest. The tree is a certificate about the chosen quotient, not about the data.
DBSCAN reads local density [33]. A point is a core point if enough neighbours fall within a radius, and clusters are the connected regions of core points. That is a reader whose read subspace is the density coordinate. Chapter 3 showed that the geodesic-distance reader of a spectral embedding discards exactly that coordinate, because the radius of the embedding converges to degree noise. Two clustering consumers of one embedding read complementary coordinates. One reads the angle and finds the shape. The other reads the radius and finds where the points are thick. Neither is wrong. They are different observers, and a report that presents one as the clustering of the data has named neither.
Spectral clustering embeds the rows in the low eigenvectors of a neighbourhood graph's Laplacian and runs k-means on the embedding. Chapter 3 proved that the step practitioners added because it worked, row normalization, is the projection onto the angular coordinate that the geodesic reader reads. Spectral clustering with row normalization is k-means run on the right quotient.
A validity index is an output metric, and it needs a null. A silhouette of 0.6 says nothing until the silhouette of the same algorithm on data with no clusters is known, and chapter 8 section 8.4 gives the rule. Section 9.3 gives the version of that rule the recognizer uses, in which the null is derived rather than simulated.
9.2 Name the manifold or certify none
A dataset that has structure often has more structure than groups. Its rows may lie near a curve, a surface, a torus, a sphere, or a product of these, and a good clustering of a torus is a poor description of it. The recognizer reads two things from the dataset's neighbourhood graph and only two [13, 18]. The pattern of low eigenvalues of the graph's Laplacian, grouped into multiplets, and the angular distances between points in the spectral embedding, which chapter 3 showed carry the geodesics. Its read subspace is the low modes. Its nuisance is the high modes and the density. It is one more row of chapter 1's consumer table, and its density blindness is the same as the geodesic reader's.
Why the low multiplets. Symmetric shapes have symmetric spectra. The circle repeats every eigenvalue twice. The sphere repeats them in groups of three, five, seven. A flat torus has its own lattice-counting pattern. A product of shapes has the product of their patterns. The first eight eigenvalue ratios are a fingerprint of the symmetry class, and the angular distances then fix the metric within the class. Together they name the shape. When the ratios match no stored template and the angular distances are inconsistent, the recognizer says none.
Dimension emerges before shape. By Weyl's law [7], section 0.15, the number of eigenvalues below a value grows like that value to the power of half the dimension. The dimension is in the exponent. The finer geometry is in the constant and the corrections. So the eigenvalue ordering fixes the dimension before it fixes the shape, and the recognizer reports dimension with confidence before it commits to a template. The staged output mirrors the mathematics rather than a convenient interface.
$$N(\lambda)=\#\{k:\lambda_k\le\lambda\}\ \sim\ C_d\,\lambda^{d/2}\qquad\Rightarrow\qquad d=2\,\frac{d\log N}{d\log\lambda}. \tag{9.2}$$
That the dimension is twice the slope of log count against log level between any two levels, whatever the constant, is machine-checked in Lean in appendix C.
The held-out battery. The recognizer originally carried four templates, a flat two-torus, a sphere, a square patch with boundary, and an interval. A preregistration added three, a cylinder, a three-torus, and a genus-two surface, froze their eight-ratio templates on one calibration seed, and bound the recognizer's code to a hash. The primary bar was that across the three new shapes and four held-out seeds, twelve instances of about 2000 points each, the best-matching template equals the true shape on at least ten. The secondary bar was that the recovered dimension of the three-torus sits strictly above both two-dimensional shapes.
| shape | recovered dimension, four seeds | template matched | angular Spearman |
|---|---|---|---|
| cylinder | 1.82, 1.81, 1.81, 1.75 | cylinder, four of four | 0.87 to 0.90 |
| three-torus | 2.79, 2.80, 2.78, 2.80 | three-torus, four of four | 0.81 to 0.82 |
| genus-two surface | 1.79, 1.72, 1.74, 1.75 | genus-two, four of four | 0.94 to 0.96 |
Twelve of twelve recognized. The three-torus read dimension 2.80 against 1.81 and 1.74. Both bars passed and the row is carried as confirmed. The preregistration also fixed, in advance, what would not count as a failure. The genus-two surface is a tube around a figure-eight and is not homogeneous, so it reads a broad eccentricity spread near 0.5 where a torus reads near 0.1, and the cylinder has a boundary and reads broad too. Both are reported as measured, not as defects, because the sealed claims were recognition and the dimension ordering.
What it refuses. Chapter 3's substrate table has the recognizer's refusals. A causal set built from Lorentzian geometry read a dimension estimate that would not settle, between 2.9 and 10.7, and an angular Spearman of 0.57. A small-world graph with its geometry destroyed read 0.45. The random-mode control read 0.01 everywhere. And on the rewriting-system substrate of chapter 3 [34], the fourth rung of validation found the angular fidelity falling from 0.747 to 0.679 as the system grew, below a preregistered floor of 0.75, with the rescue an external reviewer suggested not rescuing it. The recognizer certified none, and the record kept the verdict.
A gotcha the program logged. When the substrate is a growing system, the maximum generation read must scale with the budget, or the substrate is read before its geometry has settled. That is a measurement artifact, not a property of the substrate, and it is the clustering version of chapter 8's vacuous pass. A shape read from too few points is a certificate about the sample, not the shape.
9.3 The certificate has a vacuity threshold, and it is derived rather than fit
A recognition needs a stopping rule. At what point does the geometry become too degraded, by compression, by finite sampling, by chapter 3's collapse, for single-stage recognition to work at all? The observation program answered with a certificate whose vacuity threshold is derived from the problem [13] rather than tuned to the data, and tested it under seal on retrieval, which is recognition with one candidate per query.
The certificate. For a query with one true answer among N candidates, compute the margin, the true candidate's score minus the mean distractor score, divided by the distractors' standard deviation. Call it mu hat. If the distractors were standard normal noise, the largest of N minus one of them would have an expected value that can be computed, call it mu crit. The ratio rho, mu hat over mu crit, is the certificate. At rho equal to one the true answer is expected to tie the best distractor, and the certificate is vacuous. Nothing in that threshold was fit to any dataset.
$$\hat\mu=\frac{\bar s_{\mathrm{true}}-\bar s_{\mathrm{distr}}}{\sigma_{\mathrm{distr}}},\qquad \mu_{\mathrm{crit}}=\mathbb E\Big[\max_{N-1}\mathcal N(0,1)\Big],\qquad \rho=\frac{\hat\mu}{\mu_{\mathrm{crit}}},\qquad \rho=1\ \text{vacuous}. \tag{9.3}$$
That the bar rises with the candidate count, and that the ratio is one exactly when the margin equals the bar, are machine-checked in Lean in appendix C.
The test. Fourteen corpora, spanning isotropic, anisotropic, and heavy-tailed distributions at varied dimension and size, were swept through degradation until single-stage retrieval died, defined as recall falling to one half. The sealed bars asked whether the derived threshold locates the death point within 20 percent, whether the certificate orders the fourteen corpora by recall at a Spearman of at least 0.90, and whether it beats the unnormalized margin as a predictor.
| bar | measured |
|---|---|
| death point in units of rho | 0.948, within 6 percent of the derived 1 |
| ordering Spearman across fourteen corpora | 0.991 |
| the unnormalized margin baseline | 0.873 |
All six gated conditions passed and the row is carried as demonstrated. The transition from alive to dead is a finite-width curve centred on the derived threshold, as a real boundary should be. The scope is stated. The distractors were exchangeable, and strongly correlated distractors need an effective-rank refinement of the threshold that is registered as future work.
The path, kept. The first registration had a noise-scale bug and was degenerate. The second passed its substantive gates and failed an auxiliary sharpness gate that had been written as a step where the phenomenon has a width. The third re-specified that gate to the transition's real width, changed nothing else, and passed. The record calls this the third over-strict gate trip in the program and states the standing correction. Gate the substantive claim, the ordering and the threshold location, and express auxiliary sharpness checks with the phenomenon's real width from the outset.
For clustering the reading is direct. A validity index needs the value it would take if the data had no structure, and the sound way to get that value is to derive it from the sampling, as this certificate does, rather than to simulate it once and forget the simulation. How many clusters can be told apart at this budget is a question with a derived answer, and a clustering that reports k without reporting whether k clusters are resolvable is a certificate without its threshold.
9.4 How many dimensions does the data really use
Before asking which shape, ask how many directions the dataset actually occupies. Section 0.4 defined effective rank as the cutoff-free count, and this section has its cleanest measured use, on a dataset that is not geometric at all.
A moderation instrument reads text through nine scoring functions [35], one per moral dimension, each an encoder validated under the gate chapter 8 described. Eight of the nine had passed. The question was whether the eight scores were eight independent axes or fewer axes in disguise. The singular values of the eight scores' matrix over a corpus gave an explained-variance profile of 0.354, 0.145, 0.121, 0.116, 0.090, 0.067, 0.059, and 0.048, one dominant factor and about four more, and an effective rank of 5.19 of 8. The same finding had come from a different method on different data, which is a convergence. And the record insists on what the number is. It is a property of the deployed representation and its training corpora, not of the space it measures, because independent corpora were shown to decouple the collapsed axes. Claim the data property, not the ontological one.
The instrument then discovered a tenth axis its taxonomy lacked, and asked whether the new axis was independent. The preregistration derived the bound. If the new score were orthogonal to the eight, the effective rank would rise to the sum of the eigenvalues plus one, squared, over the sum of squared eigenvalues plus one, which is 6.08 of 9. The registered bands were at least 6.0 for independent, 5.5 to 6.0 for partially independent, and below 5.4 for largely redundant. The measurement, made after registration, was 5.679, an increase of 0.488, with the new axis correlating at most 0.339 with any existing one. Partially independent. About half an effective dimension of new signal, not redundant and not orthogonal, which is what a real but entangled axis should look like. The preregistration protected the number. The bound was 6.08, the measurement was 5.68, and the record reports it as partial.
$$r_{\mathrm{eff}}^{(9)}=\frac{\big(\sum\lambda+1\big)^{2}}{\sum\lambda^{2}+1}=\frac{(8.005+1)^{2}}{12.347+1}=6.08. \tag{9.4}$$
The clustering twin is one sentence. The number of clusters in a dataset is a property of the representation and the reader, not of the dataset, and the effective rank of the representation is the first number to report, because it bounds how many groups any reader could tell apart.
9.5 What a clustering report must state
A project report that clusters states the following beside its cluster assignments.
- The distance and its quotient. Which transformations of the rows the clustering ignores, and whether the consumer that will act on the clusters ignores the same ones.
- The reader of the clusters. What decision the assignment feeds, and whether that decision reads groups, density, or shape.
- The effective rank of the representation, computed before k is chosen, and the intrinsic dimension read from the spectrum if a neighbourhood graph was built.
- The validity index and its null, the index on the data and the same index on data with no structure, with the null derived from the sampling where possible.
- The recognizer's verdict, including none, if the data was embedded spectrally.
- The sample size the structure was found at, and whether it was read after the structure had settled.
A report that presents k clusters with a validity index and no null will be returned.
Exercises
Warm-up
- Write k-means, single-linkage hierarchical clustering, and DBSCAN as observer triples, naming what each reads.
- Why is k-means the identity reader's clustering?
- Explain how DBSCAN and spectral clustering can read complementary coordinates of the same embedding.
- Why does the recognizer need the ability to say none?
- State Weyl's law in words and explain why it lets dimension be read before shape.
- Why did the preregistration declare the genus-two surface's broad eccentricity not to be a failure?
- What does a validity index need before it can be interpreted, and where does section 9.3 get it?
- Explain in one sentence why the certificate's threshold of one is derived rather than fit.
- What was the standing correction the program adopted after its third over-strict gate?
- Why does the moderation instrument's record insist that effective rank 5.19 is a property of the representation and not of moral space?
- Why does a shape read from too few points certify the sample rather than the shape?
By hand
- Points at 0, 1, 5, and 6 on a line are clustered as the first two against the last two. Compute the sum of squared errors and the mean silhouette, following section 0.15. Then cluster them as the first three against the last one and recompute both.
- Explained-variance ratios are 0.354, 0.145, 0.121, 0.116, 0.090, 0.067, 0.059, and 0.048. Compute the effective rank.
- Eight scores have eigenvalue sum 8.005 and squared-eigenvalue sum 12.347. Compute the effective rank, and the effective rank a ninth orthogonal score with eigenvalue 1 would produce.
- A retrieval query has a margin certificate mu hat of 2.1 and the expected maximum of its distractors, mu crit, is 2.5. Compute rho and state whether single-stage retrieval is expected to be alive or dead.
- The Laplacian eigenvalues of a circle are the squares of the integers, each appearing twice. Write the number of eigenvalues below 100 and state the exponent of Weyl's law that it exhibits.
- A measured list of eigenvalue ratios is 1.0, 1.1, 1.2, 1.2, 1.4, 1.5, 1.8, 2.0. Two templates are 1.0, 1.08, 1.14, 1.19, 1.37, 1.51, 1.8, 2.01 and 1.0, 2.5, 4.39, 5.38, 8.68, 9.7, 11.33, 12.11. Compute the root-mean-square distance between logarithms for each and state the match.
- Twelve held-out instances are scored and the bar is at least ten correct. State the smallest number of failures that refutes the bar, and what the preregistration says must be named if it does.
Programming
- Cluster your project dataset with k-means, hierarchical clustering under two linkages, and DBSCAN. Report the validity index for each, then report the same index on a shuffled copy of the data in which each column is permuted independently. State which clusterings exceed their null.
- Compute the effective rank of your dataset's standardized covariance, following section 0.4. Report it beside the k you chose.
- Build a neighbourhood graph on your dataset, compute the first twenty eigenvalues of its normalized Laplacian, and plot the eigenvalue count against the eigenvalue on log axes. Report the slope and the dimension it implies by Weyl's law.
- Compute the first eight eigenvalue ratios of your dataset's Laplacian and match them by log root-mean-square distance against the templates of section 9.2's battery. Report the best match and the distance, and state whether the distance is small enough to name a shape or the recognizer should say none.
- Repeat exercise 22 on a sampled torus, a sampled sphere, and a Gaussian cloud of the same size. Report which two are recognized and which is refused.
- Subsample your dataset at four sizes and repeat exercise 21 at each. Report the dimension at each size and state the size at which it settled.
- Implement the margin certificate of section 9.3 for a retrieval task built from your dataset. Sweep a degradation of the vectors, report recall at each level, and report the rho at which recall crosses one half.
Answers to the warm-up and by-hand problems are collected in the answer key at the end of the book.
Homework 9. Certify the structure
Assigned in week 9, due Sunday of week 10. Twenty points. Uses your project dataset.
Part A, three readers (5 points). Programming exercise 19. The index table with the nulls, and one paragraph on which readers found structure and which found their own quotient.
Part B, dimension before shape (6 points). Programming exercises 20, 21, and 24. Effective rank, Weyl slope, and the dimension at four sample sizes. State the size at which it settled and whether your chosen k is below the effective rank.
Part C, the recognizer (6 points). Programming exercises 22 and 23. The template distances for your data and for the three controls. A verdict of none for your data, with the distances shown, earns full marks.
Part D, the statement (3 points). The six items of section 9.5.
Preregistration. Before Part C, commit a file stating which template, if any, you expect your data to match and the dimension you expect. 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 |
|---|---|---|
| 9.1 | the geodesic-rank reader discards the radius, row normalization is the angular projection | geometric-observation\chapters\ch09_legibility.md:10-41; the-angular-observer\theorem.md:110-146 |
| 9.2 | the recognizer's mechanism, low multiplets and angular distances, dimension before shape by Weyl's law, refusal, the growth gotcha | geometric-observation\chapters\ch11_the_recognizer.md:1-95 |
| 9.2 | the battery, three new templates, frozen ratios, code hash, bars at least 10 of 12 and the dimension ordering, eccentricity scope | the-angular-observer\PREREG_RECOGNIZER_BATTERY.md:1-80 |
| 9.2 | 12 of 12, dimensions 1.81, 2.80, 1.74, angular Spearman ranges, eccentricity spreads, verdict confirmed, GO-P-2026-041 | the-angular-observer\experiments\manifold-recovery\battery_result.json |
| 9.2 | causal set 0.57 with dimension 2.9 to 10.7, small world 0.45, control 0.01, rung 4 decay 0.747 to 0.679 below 0.75 | the-angular-observer\README.md:99-109; wolfram-observer-bridge\rung4_scaledm_result.json; wolfram-observer-bridge\review-2.txt |
| 9.3 | the margin certificate, mu crit as the expected maximum of N minus 1 standard normals, rho, death at 0.948 within 6 percent, Spearman 0.991 vs 0.873, fourteen corpora, six gates, the v1 to v3 path, the standing correction | geometric-observation\experiments\GO3-certificate-vacuity-v3-NOTES.md:1-60; geometric-observation\claims\LEDGER.md row GO-3 |
| 9.4 | explained ratios, effective rank 5.19 of 8, convergence with a second method, property of the representation not the space | gtc-prototype\docs\SPECTRUM_FINDINGS.md:10-18 |
| 9.4 | eigenvalue sums 8.005 and 12.347, bound 6.08, bands, measured 5.679, increase 0.488, max correlation 0.339, mean 0.231 | gtc-prototype\docs\IDENTITY_ATTACK.md:130-150 |
previous, Chapter 8. The evaluation is an observer too ยท next, Chapter 10. Outliers, hubs, and abstention