When the algorithm is a table

The classes held-out pairs cannot rule out

A substitution matrix can choose how many distinct costs it has as part of the fit: try all 203 ways of grouping its six pairs into classes and keep the one that best predicts pairs it was not fitted to. On corpora from a generator with two costs, that choice finds the two on about a third of resamples, and no more often at 3,200 pairs than at 50. A spurious split gains the same bit or two of fit at every size, and held-out scoring charges it a fixed price. A penalty that grows with the corpus finds the two every time, and finds a third class half a bit away from 400 pairs.

The grain a corpus chooses for itself fitted six substitution costs to corpora drawn from a generator that uses two. Transitions — a purine for a purine, a pyrimidine for a pyrimidine — cost 1.64 bits there, and transversions 4.64. The fit estimates each of the six pairs of letters separately, so it returns six numbers, and noise makes them differ. Rounding them to a lattice, which the lattice that decides the ties and the ties a rounded matrix makes had priced, turned out to resolve noise rather than remove it, so the page pooled them after the fit instead. Any two costs within two bootstrap standard errors of each other were merged, and that recovered the generator’s two classes on seven resamples of eight. The resulting matrix chose an alignment the generator agreed with for every one of 200 test pairs.

Its closing section called that a repair made from outside and proposed the principled version. A partition of the six pairs into classes is a model with one cost a class. There are 203 such partitions, from all six pairs in one class to each pair on its own. Fit each, score it by how well it predicts aligned pairs it was not fitted to, and keep the best. The prediction was that on the two-class generator this would agree with the pooling. On a generator with a third class half a bit from its neighbour, it should detect that class at 400 pairs and miss it at 40, and the size where it switches would say what a half-bit difference is worth in evidence.

The measurement follows the proposal exactly and the first prediction fails. What fails, and why, turns out to be the useful part.

Held-out pairs choose the generator’s classes a third of the time

A corpus is a set of aligned sequence pairs, each 60 letters long before indels, drawn with uniform letters. A letter survives with probability 0.9 and otherwise becomes one of its three partners with probability proportional to a weight a pair: eight for the two transitions, one for each of the four transversions. For each partition of the six pairs, one probability is fitted a class, shared equally among its pairs, from the counts of aligned letter pairs. The score is the log-likelihood of held-out columns under those probabilities. The corpus’s sequence pairs are split into five folds, and each fold is scored under a fit to the other four. A sequence pair is the unit held out, because the columns inside one pair are not independent draws.

On corpora from a generator with two costs, held-out pairs choose its two classes on 2 to 8 of 16 resamples at every size from 25 pairs to 3,200, and never more often as the corpus grows; a penalty that grows with the corpus chooses them on 15 or 16The share of 16 corpora, drawn with different seeds from a generator with two classes, on which each criterion chooses the generator's own partition of the six substitution pairs from all 203, against the number of aligned sequence pairs. Held-out pairs: 25 pairs 2, 50 pairs 8, 100 pairs 6, 200 pairs 6, 400 pairs 7, 800 pairs 4, 1,600 pairs 3, 3,200 pairs 5. A fixed penalty a class: 25 pairs 5, 50 pairs 8, 100 pairs 11, 200 pairs 7, 400 pairs 8, 800 pairs 7, 1,600 pairs 9, 3,200 pairs 9. A penalty that grows: 25 pairs 16, 50 pairs 15, 100 pairs 16, 200 pairs 16, 400 pairs 16, 800 pairs 16, 1,600 pairs 16, 3,200 pairs 16. The horizontal axis is logarithmic.1001,000aligned sequence pairs in the corpusresamples choosing the generator's classes0481216held-out pairsa fixed penalty a classa penalty that growstwo classes, 16 seeds a size203 partitions each
Fig. 1 Of 16 corpora drawn with different seeds from the two-class generator, how many lead each criterion to choose the generator’s own partition out of 203, at sizes from 25 to 3,200 pairs. Held-out pairs: 2, 8, 6, 6, 7, 4, 3 and 5. A fixed penalty a class: 5 to 11. A penalty that grows with the corpus: 16 at every size but 50 pairs, where it is 15.

Held-out scoring chooses the generator’s two classes on between 2 and 8 of 16 corpora, and it does no better at 3,200 pairs than at 50. At 3,200 pairs a corpus holds 188,106 aligned columns and the six fitted costs are each known to within a few hundredths of a bit. The score still prefers a partition with three or four classes on most seeds. It never merges the two classes the generator keeps apart. It splits classes the generator keeps together.

Two other criteria are drawn on the same plate, and neither uses held-out data. Each takes the fit’s own log-likelihood on the whole corpus and subtracts a penalty a class. The fixed penalty is 1/ln 2 = 1.44 bits a class, the Akaike criterion written in bits. The growing penalty is half the base-2 logarithm of the number of columns, which is the Bayesian information criterion; it runs from 5.3 bits at 25 pairs to 8.8 at 3,200. The fixed penalty finds the two classes about half the time and also does not improve. The growing penalty finds them on 127 of the 128 corpora.

The fixed penalty and held-out scoring behave alike, and that is not a coincidence. Held-out likelihood charges each extra parameter, in expectation, about the same fixed amount the Akaike penalty charges, which is a standard result about the two. That is the whole of the argument below, and it is visible in one number.

A spurious split gains the same at every size

The question a criterion faces is this. Given the generator’s two classes, one of the eight partitions that split a class in two fits the corpus a little better, because a split lets two counts that differ by noise have two probabilities. By how much?

Why a fixed penalty cannot settle it: splitting one of the generator's two classes in two gains a median of 2.3 bits of fit at 25 pairs and 1.4 at 3,200 — the same at every size — against a fixed penalty of 1.44 bits and a growing one of 5.3 to 8.8For 16 corpora at each size from a generator with two classes, the in-sample log-likelihood gained, in bits, by the best of the 8 partitions that split one of the generator's classes in two, over the generator's own partition. 25 pairs (1,469 columns): median 2.31, largest 4.55; on held-out pairs the split scores higher on 14 of 16; 50 pairs (2,939 columns): median 1.42, largest 6.28; on held-out pairs the split scores higher on 8 of 16; 100 pairs (5,878 columns): median 0.94, largest 4.93; on held-out pairs the split scores higher on 10 of 16; 200 pairs (11,755 columns): median 1.82, largest 4.84; on held-out pairs the split scores higher on 10 of 16; 400 pairs (23,517 columns): median 1.54, largest 3.93; on held-out pairs the split scores higher on 9 of 16; 800 pairs (47,024 columns): median 1.64, largest 6.69; on held-out pairs the split scores higher on 12 of 16; 1,600 pairs (94,056 columns): median 1.17, largest 5.29; on held-out pairs the split scores higher on 13 of 16; 3,200 pairs (188,106 columns): median 1.36, largest 4.19; on held-out pairs the split scores higher on 11 of 16. The fixed penalty a class is 1/ln 2 = 1.44 bits; the growing penalty is half the base-2 logarithm of the columns, 5.3, 5.8, 6.3, 6.8, 7.3, 7.8, 8.3, 8.8. The horizontal axis is logarithmic.1001,000aligned sequence pairs in the corpusbits of fit0246810penalty that growsfixed penalty, 1.44the split's gaintwo classes, 16 seeds a sizedots: each corpus · dashed: median
Fig. 2 For 16 corpora at each size, the in-sample log-likelihood gained by the best of the eight partitions that split one of the generator’s two classes, over the generator’s own partition. Dots are corpora; dashed is the median: 2.3 bits at 25 pairs, 0.9 at 100, 1.5 at 400, 1.2 at 1,600, 1.4 at 3,200. The fixed penalty is 1.44 bits; the growing one rises from 5.3 to 8.8. On held-out pairs the split scores above the generator’s partition on 8 to 14 of 16 corpora at every size.

The best spurious split gains about a bit and a half of fit, at every corpus size. That is what noise does. A corpus of any size has some difference between the counts of ac and gt substitutions. Given two parameters instead of one, the fit spends them on that difference and gains an amount that depends on how large the difference is relative to its own noise. That ratio does not depend on the size of the corpus. With eight splits to choose from, the best one gains a little more. The median across all eight sizes lies between 0.9 and 2.3 bits and shows no trend.

A fixed penalty of 1.44 bits sits in the middle of that distribution, so it rejects the best split on about half the corpora and accepts it on the rest, at every size. Held-out scoring does the same with more variance, because each fold’s score is itself a noisy estimate, and so it accepts the split more often. A penalty that grows with the corpus clears the whole distribution from the start and keeps clearing it by more: 5.3 bits at 25 pairs and 8.8 at 3,200, against a gain that never moves. Of the 128 corpora on the plate, the best split’s gain exceeded the growing penalty on one.

This is the arithmetic behind the plate above, and it explains why more data does not help the first two criteria. More data shrinks every fitted cost’s error. It does not shrink the likelihood gained by fitting that error, because the gain is measured in the same units as the evidence. A criterion whose price for a parameter is fixed can never refuse a spurious one with more than a fixed probability.

A result the size of its own noise met the same shape in a coding experiment. A measured win that never exceeded its own spread across streams was a property of the streams, not of the method. Here the win is a split, and its size is a property of noise that does not shrink with the corpus.

What a spurious split looks like

The partitions held-out scoring prefers are not far from the generator’s. They split the four transversions and leave the transitions alone, and the costs they give are close together.

One corpus of 400 pairs from the two-class generator: held-out pairs choose 4 classes, giving the four transversions 3 costs from 4.46 to 4.94 bits where the generator has one, 4.64; the growing penalty gives them oneThe four transversion costs fitted to corpus seed 2 of 400 pairs under three partitions. The two transitions sit near 1.64 under all three and are off this scale. Every pair its own cost (6 classes): ac 4.77, at 4.73, cg 4.46, gt 4.94. Chosen by held-out pairs (4 classes): ac 4.75, at 4.75, cg 4.46, gt 4.94. Chosen by the growing penalty (2 classes): ac 4.72, at 4.72, cg 4.72, gt 4.72. The generator's transversion cost is 4.64. Held-out pairs chose ac+at | ag+ct | cg | gt; the growing penalty chose ac+at+cg+gt | ag+ct.4.24.44.64.85.0generator: 4.64every pair its own costcgatacgtchosen by held-out pairscgacatgtchosen by the growing penaltyacatcggtfitted transversion cost, bitsone corpus, 400 pairstwo classes in the generator
Fig. 3 The four transversion costs fitted to one corpus of 400 pairs from the two-class generator, under three partitions. Every pair its own cost: cg 4.46, at 4.73, ac 4.77, gt 4.94. Chosen by held-out pairs, four classes: cg 4.46, ac and at together at 4.75, gt 4.94. Chosen by the growing penalty, two classes: all four at 4.72. The generator’s transversion cost is 4.64.

On this corpus the held-out score chose four classes. It pooled ac and at, which were 0.04 bits apart, and kept cg and gt separate, 0.29 bits below them and 0.19 above. Those are fair readings of the counts. Taken as costs, they say a c↔g substitution is 22% more likely than an a↔c one, which the generator does not do. The growing penalty returned one transversion cost of 4.72, eight hundredths from the generator’s value, the offset being the fit’s estimate of how often any transversion happens at all.

The split is a claim about the process that drew the corpus. The matrix a corpus wrote built fitted matrices on the principle that a cost is only as good as the counts it came from. Held-out scoring does not violate that principle. It asks a different question, which grouping predicts best, and a grouping that separates two nearly equal counts can predict slightly better on the fold in hand. The growing penalty asks which grouping is most probably the process’s own, and that question can be answered with certainty as the corpus grows. The two questions have different answers, and the proposal on the earlier page named the first while meaning the second.

A class that is there

The second half of the proposal plants a class and asks when it can be seen. The three-class generator gives two of the four transversions, at and cg, a weight of 1/21/\sqrt{2} instead of one. That makes their cost exactly half a bit higher: 5.10 bits against 4.60 for ac and gt, with the transitions at 1.60. Every letter keeps one partner of each kind, so the letters stay uniform.

A third class planted half a bit from its neighbour: the growing penalty finds it on none of 16 resamples at 100 pairs, 8 at 400 and all 16 from 1,600; held-out pairs find it on 8 at 400 and 8 at 3,200, because past it they keep splittingThe share of 16 corpora, drawn with different seeds from a generator with three classes, half a bit apart, on which each criterion chooses the generator's own partition of the six substitution pairs from all 203, against the number of aligned sequence pairs. Held-out pairs: 25 pairs 3, 50 pairs 2, 100 pairs 5, 200 pairs 8, 400 pairs 8, 800 pairs 9, 1,600 pairs 10, 3,200 pairs 8. A fixed penalty a class: 25 pairs 3, 50 pairs 1, 100 pairs 7, 200 pairs 7, 400 pairs 11, 800 pairs 11, 1,600 pairs 13, 3,200 pairs 10. A penalty that grows: 25 pairs 1, 50 pairs 0, 100 pairs 0, 200 pairs 4, 400 pairs 8, 800 pairs 14, 1,600 pairs 16, 3,200 pairs 16. The horizontal axis is logarithmic.1001,000aligned sequence pairs in the corpusresamples choosing the generator's classes0481216held-out pairsa fixed penalty a classa penalty that growsthree classes, half a bit apart, 16 seeds a size203 partitions each
Fig. 4 Of 16 corpora from the three-class generator, how many lead each criterion to choose its partition of the six pairs. The growing penalty: 1, 0 and 0 at 25, 50 and 100 pairs; 4 at 200, 8 at 400, 14 at 800, and 16 from 1,600. Held-out pairs: 2 to 5 below 200 pairs, then 8, 8, 9, 10 and 8. A fixed penalty a class: 1 to 7 below 200 pairs, then 7, 11, 11, 13 and 10.

The growing penalty finds the half-bit class on none of 16 corpora at 100 pairs, on half at 400, and on every one from 1,600. Its switch is between 200 and 800 pairs, and 400 pairs — about 24,000 aligned columns, of which about 240 are ac or gt substitutions and 165 are at or cg — is where the difference becomes as likely to be seen as not. Below that it says two classes, and it is wrong in the safe direction. It merges the half-bit class into its neighbour, which is what the evidence can support, and it never invents a class.

Held-out scoring’s curve looks better at the small sizes, and it is not. At 100 pairs it chose three classes on ten of the sixteen corpora and the right three on five. The rest split something else, because it splits whatever the noise offers and here the noise and the signal are the same size. From 200 pairs up it holds between 8 and 10 of 16, and it falls back to 8 at 3,200, because past the true partition it keeps splitting. At 3,200 pairs it chose four or five classes on eight corpora, all of them refinements of the generator’s three.

So the prediction’s second half is right about the size and wrong about the criterion. A half-bit class does become visible at about 400 pairs. The criterion that reports it reliably from there is the one that also refuses to report classes that are absent, and held-out scoring cannot refuse.

What the choice does to alignments

The earlier page scored every matrix by the alignments it chooses, against the generator: an alignment is right if it is optimal under the generator’s own costs. The same scoring separates the partitions here, and it separates them less than the plates above.

What the choice costs in alignments: on the two-class generator at 100 pairs, held-out pairs' extra classes get 191.6 of 200 test alignments right against 198.5; on the three-class generator at 1,600 pairs, merging the planted class gets 193.4 against 199.8Mean over eight corpora of how many of 200 test pairs get an alignment that is optimal under the generator's own costs, for the matrix each partition gives. Two classes, 100 pairs: six costs 190.38 (worst 171), held-out pairs 191.63 (worst 170), growing penalty 198.50 (worst 195), the generator's classes 198.50 (worst 195). Two classes, 400 pairs: six costs 199.38 (worst 198), held-out pairs 200.00 (worst 200), growing penalty 200.00 (worst 200), the generator's classes 200.00 (worst 200). Three classes, half a bit apart, 400 pairs: six costs 194.88 (worst 164), held-out pairs 191.88 (worst 143), growing penalty 189.75 (worst 143), the generator's classes 192.88 (worst 143), the two-class merge 193.50. Three classes, half a bit apart, 1,600 pairs: six costs 199.75 (worst 199), held-out pairs 199.63 (worst 199), growing penalty 199.75 (worst 199), the generator's classes 199.75 (worst 199), the two-class merge 193.38. The axis starts at 180.180185190195200two classes100 pairs190.4191.6198.5198.5two classes400 pairs199.4200.0200.0200.0three classes400 pairs194.9191.9189.8192.9three classes1,600 pairs199.8199.6199.8199.8six costsheld-out pairsgrowing penaltythe generator's classes200 test pairs, eight corporaright = optimal under the generator
Fig. 5 Mean over eight corpora of how many of 200 test pairs each partition’s matrix aligns as the generator would. Two classes, 100 pairs: six costs 190.4, held-out 191.6, growing penalty 198.5, the generator’s partition 198.5. Two classes, 400 pairs: 199.4, 200, 200, 200. Three classes, 400 pairs: 194.9, 191.9, 189.8, 192.9. Three classes, 1,600 pairs: 199.8, 199.6, 199.8, 199.8; merging the planted class, 193.4.

At 400 pairs from the two-class generator, a spurious split costs nothing: held-out scoring’s three and four classes get all 200 alignments right on all eight corpora. Its costs differ by a few tenths of a bit within a class the generator treats as one, and that rarely changes which alignment is cheapest. At 100 pairs the extra classes cost more, 191.6 against 198.5, because the split costs are further apart when counts are small and the splits change alignments that trade one transversion for another.

At 1,600 pairs from the three-class generator, the half-bit class matters. A matrix that merges it gets 193.4 alignments right; any matrix that keeps it gets 199.6 or more. Six or seven of 200 test alignments turn on whether at costs half a bit more than ac.

The three-class case at 400 pairs is dominated by something else. On one corpus of the eight the fitted transition and the cheaper transversion add to 6.00 bits, which is exactly the price of two gaps. Every matrix that keeps those two fitted costs, including the generator’s own partition, trades substitutions for gaps on dozens of test pairs and gets 143 right. That is the boundary effect the parameter plane has few answers mapped: an alignment is fixed within a region of cost space and changes at its boundary, and a fitted cost can land on one by chance. The six-cost matrix gets 164 on that corpus, because its separate costs put some of those pairs back on the right side of the boundary.

So the alignment count is the right final score and a poor instrument for choosing among partitions. It turns on a handful of boundaries. The likelihood of held-out columns is the right instrument, and it needs a price for parameters that grows.

Why the growing penalty is the one to use here

The growing penalty was not proposed on the earlier page, and its success is not an accident of this substitution process. It is built to identify the process that produced the data. Among nested models, it chooses the true one with probability tending to one as the data grow, because a spurious class’s gain stays fixed while the price rises with the logarithm of the columns. Held-out scoring and the fixed penalty are built to choose the model that predicts best, which they do. On a finite corpus the model that predicts best can be one with a spurious class, since the class costs almost nothing in prediction.

Which one a matrix should use depends on what the matrix is for. If the costs are only there to score alignments of more sequences from the same process, the difference is small: the right-alignments plate shows a split within a class costing nothing at 400 pairs. If the costs are read as a statement about the process — that a c↔g change is 22% likelier than an a↔c one — then held-out scoring makes false statements about a third to two thirds of the time at every corpus size, and more data will not fix it.

Fitting a class to measurements grants a growth class only when a fit with that class holds and a fit with one fewer parameter does not. The growing penalty is the same standard applied to substitution costs, and it is the standard the pooling on the earlier page approximated. Two standard errors is a fixed threshold — a constant of the kind the threshold somebody chose went looking for — and the pooling found two classes on seven of eight corpora at 400 pairs. On the three-class generator it found the half-bit class on four of eight at 400 and eight of eight at 1,600, almost exactly the growing penalty’s record. The earlier page’s repair was closer to right than the principled version it proposed.

What was measured and what was not

A generator whose classes are exact. Every cost here belongs to a class with exactly one value. A real substitution process — twenty amino acids, graded by chemistry — may have no exact classes at all, and then every criterion is choosing how much of a continuum to resolve. The growing penalty would keep splitting as the data grew, correctly, and the question would become which resolution is useful rather than which is true.

Letters that are uniform. The fit here uses one probability a class and a uniform background, which is exact for these generators. A real alphabet’s letter frequencies differ, and a class of pairs would then need its costs fitted as log-odds against each pair’s background rather than as one shared probability.

Five folds and one shuffle. Held-out scoring was run with one assignment of sequence pairs to five folds. A different number of folds changes its variance and slightly changes its effective penalty. Leaving out one pair at a time makes it behave still more like the fixed penalty, which is the direction the measured criterion was already failing in.

All 203 partitions, including absurd ones. The search considered partitions that pool a transition with a transversion. None was ever chosen, by any criterion, on any corpus. A search limited to partitions of the transitions and transversions separately would give the same answers here, and on a larger alphabet the full space of partitions (the Bell numbers grow faster than exponentially) could not be searched at all.

Still open: a class whose cost is not its members’ mean

Every partition here gives each class one cost, fitted from the pooled counts of its members. A cost that is not one began this line of argument with a different kind of matrix: costs computed from a rule about the letters, such as purine against pyrimidine or keyboard distance, with a few parameters shared across all pairs. A partition is one such rule — a list of which pairs are the same — and there are others. A matrix could have a transition cost and a transversion cost plus a single extra term for pairs that also differ in some second property of the letters, fitted as one parameter across all the pairs it touches.

The measurement that follows draws a corpus from a generator whose costs are a sum of two such terms, one for class and one for a second property that crosses the classes, so that no partition of the pairs is exactly right. It compares the growing penalty’s best partition with a two-term additive model. The additive model has fewer parameters than the partition that would fit the same costs exactly. The prediction is that on such a generator the best partition needs four or five classes where the additive model needs two terms. It would reach the generator’s alignments with less data, because a shared term pools evidence across pairs no partition would group. That would make partitions the wrong space to search whenever costs come from more than one property of the letters, which is the ordinary case for proteins.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the concept index makes visible.

The objects this essay names

Each one links to every other essay that touches it.

AlignmentCorpusCost modelCross validationEstimatorFittingHonest limitModel selectionOverfittingParameter choiceSubstitution matrix