Many repeating signals have no single obvious period. A drum pattern can be heard at 60 or at 120 beats per minute. A juggler's video can be counted as one throw per cycle or two. A road's traffic can look like it repeats every 12 hours because it has a morning peak and an evening peak, when the true pattern repeats every 24 hours because those two peaks differ. Music researchers call this octave ambiguity: the estimator lands on twice, half, or three times the true period. Visualization systems that summarize thousands of time series or trajectories face the same problem without naming it. When they cut series into cycles, aggregate them, and draw a summary, a wrong period produces a summary that is clean and wrong. It may fold two different half-cycles into one, or it may draw a "loop" that no single agent ever travels.
We propose to treat the choice of period as a Bayesian model comparison over a small, explicitly enumerated set of integer-ratio hypotheses (P/3, P/2, P, 2P, 3P), and to score each hypothesis by its exact marginal likelihood. The marginal likelihood is the probability of the data averaged over all parameter settings the model allows. These hypotheses are nested: a model with period 2P contains every model with period P as a special case. Raw fit therefore always favors the longer period, while the marginal likelihood charges for the extra freedom. The question becomes concrete: is the difference between odd and even half-cycles real, or noise? This is the symmetric-phase failure that breaks video repetition counting, and it is the question a cycle-folding display has to answer before it draws anything. We test the selector on standard tempo and repetition benchmarks, where ground truth exists. We then use it to set the folding period in summaries of many time series, such as ECG records and per-corridor traffic counts, where a wrong period quietly changes what the viewer sees.
Core Claim
Octave errors come from comparing nested periodic models by fit alone. This happens explicitly in peak-picking and implicitly in learned predictors. An exact Occam-penalized evidence comparison over the enumerated integer-ratio lattice should fix the common failure mode without any training labels. In that failure mode, the true period is ranked near the top of the candidates but loses to its double or half. Two works motivate this claim. An Application of Empirical Mode Decomposition on Tempo Induction from Music Recordings builds self-similarity "rhythmic signatures" and picks valleys heuristically, reaching 79% accuracy, with failures dominated by exact double or half tempos. It also observes that the true tempo usually remains highly ranked among the candidates. That observation tells us a re-ranking step, rather than a new detector, may be enough.
Two works constrain the design. Structure Discovery in Nonparametric Regression through Compositional Kernel Search runs a greedy search over Gaussian-process kernels, guided by the Bayesian Information Criterion (BIC, a large-sample approximation to the marginal likelihood). It reports that the search can "latch onto a harmonic rather than the true period." We read this failure as two separable causes: greedy local search over continuous period hyperparameters, and an asymptotic penalty that is crude when only a few cycles are observed. Our design removes both. We enumerate the discrete lattice instead of searching it, and we compute the evidence exactly in a conjugate model instead of approximating it with BIC. The method itself comes from Bayesian Model Comparison and Backprop Nets. MacKay's two-level evidence framework, where hyperparameters are set by maximizing the evidence and models are then compared on it, lets us avoid the known weakness of overly diffuse priors, which over-penalize genuinely complex structure.
What would be new is not Bayesian period estimation in general. It is three specific things. The first is reformulating octave disambiguation as nested evidence comparison on an enumerated lattice, layered on top of any candidate generator. The second is showing on standard benchmarks that this matches or improves learned octave-resolution machinery. The third is carrying the same selector into time-series and flow visualization as the rule that sets the folding period. None of the cited visualization systems has such a rule.
Research Program
The model. For a window of a one-dimensional feature $y \in \mathbb{R}^n$ we use a linear-Gaussian model. The feature can be an audio onset envelope, a row-summary of a video self-similarity matrix, an ECG lead, or a traffic count series for one corridor. Under period hypothesis $P$ the model writes $y = \Phi_P w + \epsilon$. Here $\Phi_P$ holds sine and cosine columns at the first $H_P$ harmonics of $1/P$. The coefficients $w$ have a zero-mean Gaussian prior with covariance $\Sigma$, whose variances decay with harmonic index, and the noise $\epsilon$ has variance $\sigma^2$. The evidence is then exact:
$$\log p(y \mid P) = \log \mathcal{N}\!\left(y;\, 0,\; \Phi_P \Sigma \Phi_P^\top + \sigma^2 I\right).$$
We fix the highest represented frequency across hypotheses, so $H_{2P} = 2H_P$. Under that choice the 2P model is exactly the P model plus the odd harmonics of $1/(2P)$, and the log Bayes factor $\log p(y\mid 2P) - \log p(y\mid P)$ measures directly whether alternating-cycle asymmetry is supported. The prior scale and $\sigma^2$ are shared across hypotheses within a recording and set by type-II maximum likelihood, following MacKay. This keeps every hypothesis on equal footing and avoids the diffuse-prior trap. Candidate base periods P come from any generator: autocorrelation, a neural tempo network's candidate list, or RepNet's period output. To handle tempo drift, we compute window-level evidences and smooth them with a hidden Markov chain over metrical level. This borrows the decoding role that the dynamic Bayesian network plays in Deconstruct, Analyse, Reconstruct. The difference is that our states are scored by model evidence rather than by network activations.
Analysis. We will characterize, on synthetic signals, when evidence correctly picks 2P over P as a function of the number of observed cycles, the asymmetry amplitude, and the noise level. We will also characterize when it fails, for instance when one half-cycle is a near-copy of the other. This is where BIC and exact evidence should differ most, since they differ most when n is small. We will check compound meters (6/8, 9/8), which Böck and Davies list as a weakness of their system, by including the 3P and P/3 hypotheses.
Visualization use. TiVy segments series with fixed sliding windows and clusters the segments, and it is known to be sensitive to the window choice. Reducing Ambiguities in Line-based Density Plots by Image-space Colorization separates overlapping lines in image space, which is how it exposed the false "ring road" in Beijing taxi data, but it says nothing about periodic structure. We replace the fixed window with a per-series, evidence-selected folding period. Each series is cut into cycles of its selected period, cycles are overlaid in phase, and the display marks series whose 2P-versus-P Bayes factor is decisive, for example with a split glyph showing the two distinct half-cycles. For corridor flows, we fold each corridor's count series at its selected period. The flow map can then distinguish a corridor with a genuine 24-hour asymmetric commute from one with two equivalent 12-hour pulses. The same posterior over hypotheses provides a principled reason to merge series into a small number of displayed groups when their selected models agree. This gives a modest, testable answer to the tension between what the evidence prefers and the roughly seven hues a viewer can tell apart.
Baselines
The naive reference point is plain autocorrelation peak-picking, and its tempo variant restricted to a 60–180 BPM band. This is what a visualization pipeline would do by default. Its failure modes are documented by Two Data Sets for Tempo Estimation and Key Detection in Electronic Dance Music and Accurate Tempo Estimation Based on Recurrent Neural Networks and Resonating Comb Filters. It runs on exactly the same features and candidate set as our method.
The strongest audio competitor is the multi-task temporal convolutional network with metrical dilations and joint beat and downbeat decoding from Deconstruct, Analyse, Reconstruct. It resolves octave errors with learned hierarchy and is reported to reach "over 83% Accuracy 1 for tempo across three unseen test datasets," a 6% gain over prior systems. We do not try to beat it from raw features with a training-free model. Our test is whether adding evidence re-ranking on top of its candidate list raises Accuracy 1 while leaving Accuracy 2 unchanged. Accuracy 1 counts a tempo as correct only at the true metrical level; Accuracy 2 also accepts double, half, and triple. The gap between the two is exactly the octave-error rate. We will run the authors' released or retrained model on the same splits, with no additional tuning of our method beyond the type-II hyperparameters. Raising Accuracy 1 on GTZAN and Hainsworth with Accuracy 2 fixed counts as beating it. Beat Transformer is a second learned reference for beat and downbeat. The file reports only its downbeat F-measure gain and no tempo number, so we use it for the beat-level CMLt metric only.
For repetition counting the strongest baseline is RepNet from Counting Out Time. It reports a mean absolute counting error of 0.104 on QUVA and an F1 of 0.820 for periodicity detection on PERTUBE, and it acknowledges double counting on symmetric-phase actions. We apply evidence re-ranking to its predicted period using its own temporal self-similarity features. A lower error on QUVA, and on the Countix subset of symmetric-phase actions, counts as a win. For Countix itself the file records no reported result.
The key ablation replaces exact evidence with BIC on the identical enumerated lattice. If BIC matches exact evidence, the contribution reduces to enumeration plus nesting, and we will say so. A second ablation reproduces the greedy compositional kernel search of Structure Discovery in Nonparametric Regression on the synthetic suite, to measure how much of its harmonic failure comes from the search and how much from the penalty. On the visualization side, the baselines are TiVy with its default window and Xue et al.'s colorization, both run on identical data.
Why not just…?
Why not just use the learned tempo network, which already resolves most octave errors? On mainstream Western audio this is a real threat. The Böck and Davies system is trained precisely for this purpose, and our re-ranking may add nothing there. That is why the audio experiment is framed as a layer on top of that system, not a replacement. The case for our method rests on two settings. The first is harder material: compound meters and microtiming-heavy styles, such as those in Tracking Beats and Microtiming in Afro-Latin American Music, where Böck and Davies report weakness. The second is unlabeled domains such as ECG and traffic, where no trained metrical model exists. If evidence re-ranking gives no Accuracy 1 gain even on the hard subsets, the audio claim is dropped and the work becomes a visualization contribution.
Why not just use BIC, as the kernel-search work did? For nested Fourier models BIC also penalizes the 2P hypothesis by its extra parameter count, so it may well behave the same. BIC's penalty is asymptotic, however, and ignores prior volume. It should be least reliable when only three or four cycles are observed, which is the common case in windowed audio and in short trajectory records. The BIC-on-the-same-lattice ablation, stratified by number of observed cycles, settles this directly.
Why not just hold out cycles and cross-validate the period? Forward-chaining cross-validation over held-out cycles is a legitimate selector and is included as a baseline. With few cycles it must discard the very data that reveal asymmetry, which is the data-efficiency argument MacKay made for evidence over held-out validation. We expect cross-validation to match evidence when there are many cycles and to fall behind when there are few. If it does not, it is the simpler choice and we will recommend it.
Why not just fix the folding window by hand, as current summaries do? A hand-set window works when all series share one known period. It fails when the series in a collection differ, for example normal ECG rhythms mixed with alternating ones, or corridors with daily versus twice-daily structure. The synthetic and ECG experiments measure how often a single global window mis-folds individual series.
Proposed Experiments
The first experiment is synthetic and controlled. We generate signals and agent trajectories with known periods, varying the asymmetry between alternating half-cycles, the number of cycles, the noise level, and the meter (duple or triple). We measure metrical-level accuracy for the naive baseline, BIC, cross-validation, greedy kernel search, and exact evidence. The decisive check is that exact evidence beats BIC specifically in the few-cycle regime. If it does not, the exactness claim fails.
The second experiment uses audio benchmarks. We report Accuracy 1 and Accuracy 2 for tempo on GTZAN, Ballroom, Hainsworth, and SMC, together with the 400-track set used by Pikrakis and Theodoridis where available. We compare the naive baseline, the Böck and Davies system, and that system plus evidence re-ranking, and we analyze the compound-meter subset separately. The third experiment applies the same re-ranking to RepNet, reporting counting error on QUVA and on symmetric-phase Countix clips.
The fourth experiment uses visualization data. On the MIT-BIH arrhythmia records, the dataset's beat annotations identify alternating-beat rhythms. These give per-record ground truth for whether the true period spans one beat or two. We measure folding-period accuracy and the purity of TiVy-style cluster summaries under the default window versus the evidence-selected window. On the Beijing taxi data we fold per-corridor counts. Since this data has no period ground truth, the check is a controlled user study modeled on Xue et al.'s 25-participant design. Participants answer questions about cycle structure, such as whether a corridor's two daily peaks are the same or different, using the TiVy default, image-space colorization, or the evidence-folded display. Answers are scored against synthetic-injected ground truth.
The proposal succeeds if three things hold: evidence beats BIC when cycles are few, it closes part of the Accuracy 1 to Accuracy 2 gap on at least the hard audio subsets, and it reduces mis-folding and wrong user answers in the display study.
References
- An Application of Empirical Mode Decomposition on Tempo Induction from Music Recordings
- Structure Discovery in Nonparametric Regression through Compositional Kernel Search
- Bayesian Model Comparison and Backprop Nets
- Deconstruct, Analyse, Reconstruct: How to improve Tempo, Beat, and Downbeat Estimation
- TiVy: Time Series Visual Summary for Scalable Visualization
- Reducing Ambiguities in Line-Based Density Plots by Image-Space Colorization
- Two Data Sets for Tempo Estimation and Key Detection in Electronic Dance Music Annotated from User Corrections
- Accurate Tempo Estimation Based on Recurrent Neural Networks and Resonating Comb Filters
- Beat Transformer: Demixed Beat and Downbeat Tracking with Dilated Self-Attention
- Counting Out Time: Class Agnostic Video Repetition Counting in the Wild
- Tracking Beats and Microtiming in Afro-Latin American Music Using Conditional Random Fields and Deep Learning