|
Download README.md from Trackertracker2/closed-leg-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 7.25 kB
-
https://huggingface.co/datasets/Trackertracker2/closed-leg-benchmark/resolve/main/README.md
- Command line
-
hf download hf://datasets/Trackertracker2/closed-leg-benchmark/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Trackertracker2/closed-leg-benchmark/resolve/main/README.md
7.25 kB
| license: mit | |
| language: | |
| - en | |
| tags: | |
| - fractal | |
| - fractal-dimension | |
| - box-counting | |
| - hurst-exponent | |
| - self-affine | |
| - time-series | |
| - signal-processing | |
| - benchmark | |
| - ground-truth | |
| - synthetic | |
| - roughness | |
| - estimator-validation | |
| pretty_name: Fractal Dimension Benchmark — synthetic signals with exactly known dimension | |
| size_categories: | |
| - n<1K | |
| configs: | |
| - config_name: default | |
| data_files: data/signals.parquet | |
| - config_name: index | |
| data_files: data/signals_index.csv | |
| # Fractal Dimension Benchmark | |
| **Ground truth for fractal dimension estimators.** 76 synthetic time series whose box-counting | |
| dimension is known exactly — in closed form, per file, not in expectation. | |
| If you are building or testing a **fractal dimension estimator**, a **Hurst exponent | |
| estimator**, a **roughness measure**, a box-counting implementation, a variogram or | |
| detrended-fluctuation method, this is a test set where you already know every answer. | |
| Dimensions span **1.05 to 1.95** in steps of 0.05, at 19,684 samples each. Deterministic and | |
| reproducible bit for bit. | |
| Companion tool and derivation: [10.5281/zenodo.22052384](https://doi.org/10.5281/zenodo.22052384) | |
| --- | |
| ## Why fBm is not enough | |
| The usual test signal for a dimension estimator is **fractional Brownian motion**. Its box | |
| dimension is `2 − H`, which is correct **on average**. But any single realization you hand | |
| someone deviates from that by an unknown amount, so when your estimator reads 1.47 on a signal | |
| labelled 1.50, you cannot tell whether your estimator is off, or the realization is. | |
| You are checking a ruler against a stick that is roughly a metre, usually. | |
| These signals are deterministic. Given the file, the true value is a closed-form expression. | |
| Given the seed, the file regenerates bit for bit on any machine. | |
| --- | |
| ## The construction | |
| Each signal is a *closed-leg recursion*: replace a segment with three legs whose signed heights | |
| sum to one, then replace each leg with a scaled copy of the whole figure, repeatedly. With | |
| equal durations the box dimension is exactly | |
| ``` | |
| D = 1 + log₃( |d₁| + |d₂| + |d₃| ) | |
| ``` | |
| so to hit a target `D` you solve `Σ|dᵢ| = 3^(D−1)` subject to `Σdᵢ = 1`. The balanced solution | |
| ``` | |
| b = (3^(D−1) − 1) / 2 , s = 1 + b , legs = ( s/2 , −b , s/2 ) | |
| ``` | |
| keeps every leg under 1 in magnitude across the whole range, which is the condition for the | |
| limit curve to exist. | |
| This is Barnsley's affine fractal interpolation function (1986). The dimension formula is | |
| classical. Nothing here is claimed as new mathematics — what is offered is the test set. | |
| --- | |
| ## Two kinds of signal, and the difference matters | |
| **`shuffled_*` — 57 signals, 3 seeds at each dimension.** | |
| The leg *order* is shuffled at every subdivision. Because addition does not care about order, | |
| `Σ|dᵢ|` is untouched and the box dimension is **still exactly** the stated value. What changes | |
| is that the curve is no longer exactly self-similar, only statistically so — which averages | |
| away multifractality and makes these the right target for a plain single-number estimator. | |
| **`fixed_*` — 19 signals, one at each dimension.** | |
| The same legs in fixed order. Identical exact box dimension, but genuinely **multifractal**: | |
| roughness varies from point to point, so an increment-based estimator will legitimately | |
| disagree with the box dimension. These test whether your estimator *notices* that one number is | |
| not enough. | |
| An estimator that scores well on `fixed_*` without flagging the disagreement is not measuring | |
| what it claims to measure. | |
| --- | |
| ## Contents | |
| ``` | |
| data/signals.parquet all 76 signals, 1,495,984 rows, long format: | |
| signal_id, kind, target_dimension, true_dimension, | |
| seed, t, value | |
| data/signals_index.csv 76 rows, one per signal, with the leg coefficients | |
| ``` | |
| Dimensions run from **1.05 to 1.95** in steps of 0.05, at 19,684 samples per signal. The `t` | |
| column is the sample index; samples are evenly spaced by construction, so there is no clock | |
| time. Sort by `t` within a `signal_id` before measuring. | |
| --- | |
| ## Loading it | |
| ```python | |
| from datasets import load_dataset | |
| import numpy as np, pandas as pd | |
| ds = load_dataset("Trackertracker2/closed-leg-benchmark", split="train") | |
| df = ds.to_pandas() | |
| # one signal | |
| g = df[df.signal_id == "shuffled_D1.50_s1"] | |
| y = g.value.to_numpy() | |
| print(g.true_dimension.iloc[0]) # 1.500000000000 | |
| ``` | |
| Scoring your estimator across the whole shuffled set: | |
| ```python | |
| errs = [] | |
| for sid, g in df[df.kind == "shuffled"].groupby("signal_id"): | |
| y = g.sort_values("t").value.to_numpy().astype(float) | |
| errs.append(your_estimator(y) - g.true_dimension.iloc[0]) | |
| errs = np.abs(errs) | |
| print(f"mean |error| {errs.mean():.4f} worst {errs.max():.4f}") | |
| ``` | |
| Straight from parquet, without the `datasets` library: | |
| ```python | |
| df = pd.read_parquet("https://huggingface.co/datasets/Trackertracker2/" | |
| "closed-leg-benchmark/resolve/main/data/signals.parquet") | |
| ``` | |
| --- | |
| ## A reference score | |
| The estimator in the companion deposit — three variogram-of-order-*p* estimators at | |
| *p* = ½, 1, 2, taking the median — scores: | |
| | set | mean abs. error | worst | | |
| |---|---|---| | |
| | `shuffled_*` | **0.021** | 0.093 | | |
| | `fixed_*` | 0.088 | 0.164 | | |
| Its accuracy is **not uniform**. Errors are smallest around *D* = 1.6 and grow toward the top of | |
| the range, reaching about 0.09 near *D* = 1.95. | |
| That degradation is a property of the estimator, not of the benchmark, and surfacing it is the | |
| point. An estimator that does well at 1.5 and poorly at 1.9 is worth knowing about before you | |
| trust it on data whose answer you do not have. | |
| --- | |
| ## Caveats, stated plainly | |
| - These are **self-affine graphs**, not general rough signals. An estimator tuned to them may | |
| still behave differently on physical data. This benchmark tests correctness against known | |
| ground truth; it does not certify performance in the field. | |
| - **19,684 points** is a moderate record length. Estimators needing longer series will be | |
| penalised. That is fair, but it should be said. | |
| - Large errors on `fixed_*` are **expected**, not failures — those signals are multifractal by | |
| construction. Read them alongside whatever multifractality diagnostic your tool provides. | |
| - The signals occupy a **narrow structural class**. Good scores here are necessary for trusting | |
| an estimator, not sufficient. | |
| --- | |
| ## Citation | |
| The full tool, specification and derivation: | |
| - Roughness — a validated measure of texture for ordered signals. | |
| [10.5281/zenodo.22052384](https://doi.org/10.5281/zenodo.22052384) | |
| - The Closed-Leg Atlas — a browser for self-affine and self-similar curves. | |
| [10.5281/zenodo.22040679](https://doi.org/10.5281/zenodo.22040679) | |
| ```bibtex | |
| @software{koch_roughness_2026, | |
| author = {Koch, W. A.}, | |
| title = {Roughness: a validated measure of texture for ordered signals}, | |
| year = {2026}, | |
| doi = {10.5281/zenodo.22052384}, | |
| url = {https://doi.org/10.5281/zenodo.22052384} | |
| } | |
| ``` | |
| W. A. Koch · [ORCID 0009-0001-1341-7871](https://orcid.org/0009-0001-1341-7871) | |
| Prepared with AI assistance for numerical verification and code. Every value in the answer key | |
| is a closed-form expression, independently recomputed. | |