Trackertracker2 commited on
Commit
9fb7fc8
·
verified ·
1 Parent(s): b314ec7

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +204 -0
  2. data/signals.parquet +3 -0
  3. data/signals_index.csv +77 -0
README.md CHANGED
@@ -1,3 +1,207 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
+ tags:
6
+ - fractal
7
+ - fractal-dimension
8
+ - box-counting
9
+ - hurst-exponent
10
+ - self-affine
11
+ - time-series
12
+ - signal-processing
13
+ - benchmark
14
+ - ground-truth
15
+ - synthetic
16
+ - roughness
17
+ - estimator-validation
18
+ pretty_name: Fractal Dimension Benchmark — synthetic signals with exactly known dimension
19
+ size_categories:
20
+ - n<1K
21
+ configs:
22
+ - config_name: default
23
+ data_files: data/signals.parquet
24
+ - config_name: index
25
+ data_files: data/signals_index.csv
26
  ---
27
+
28
+ # Fractal Dimension Benchmark
29
+
30
+ **Ground truth for fractal dimension estimators.** 76 synthetic time series whose box-counting
31
+ dimension is known exactly — in closed form, per file, not in expectation.
32
+
33
+ If you are building or testing a **fractal dimension estimator**, a **Hurst exponent
34
+ estimator**, a **roughness measure**, a box-counting implementation, a variogram or
35
+ detrended-fluctuation method, this is a test set where you already know every answer.
36
+
37
+ Dimensions span **1.05 to 1.95** in steps of 0.05, at 19,684 samples each. Deterministic and
38
+ reproducible bit for bit.
39
+
40
+ Companion tool and derivation: [10.5281/zenodo.22052384](https://doi.org/10.5281/zenodo.22052384)
41
+
42
+ ---
43
+
44
+ ## Why fBm is not enough
45
+
46
+ The usual test signal for a dimension estimator is **fractional Brownian motion**. Its box
47
+ dimension is `2 − H`, which is correct **on average**. But any single realization you hand
48
+ someone deviates from that by an unknown amount, so when your estimator reads 1.47 on a signal
49
+ labelled 1.50, you cannot tell whether your estimator is off, or the realization is.
50
+
51
+ You are checking a ruler against a stick that is roughly a metre, usually.
52
+
53
+ These signals are deterministic. Given the file, the true value is a closed-form expression.
54
+ Given the seed, the file regenerates bit for bit on any machine.
55
+
56
+ ---
57
+
58
+ ## The construction
59
+
60
+ Each signal is a *closed-leg recursion*: replace a segment with three legs whose signed heights
61
+ sum to one, then replace each leg with a scaled copy of the whole figure, repeatedly. With
62
+ equal durations the box dimension is exactly
63
+
64
+ ```
65
+ D = 1 + log₃( |d₁| + |d₂| + |d₃| )
66
+ ```
67
+
68
+ so to hit a target `D` you solve `Σ|dᵢ| = 3^(D−1)` subject to `Σdᵢ = 1`. The balanced solution
69
+
70
+ ```
71
+ b = (3^(D−1) − 1) / 2 , s = 1 + b , legs = ( s/2 , −b , s/2 )
72
+ ```
73
+
74
+ keeps every leg under 1 in magnitude across the whole range, which is the condition for the
75
+ limit curve to exist.
76
+
77
+ This is Barnsley's affine fractal interpolation function (1986). The dimension formula is
78
+ classical. Nothing here is claimed as new mathematics — what is offered is the test set.
79
+
80
+ ---
81
+
82
+ ## Two kinds of signal, and the difference matters
83
+
84
+ **`shuffled_*` — 57 signals, 3 seeds at each dimension.**
85
+ The leg *order* is shuffled at every subdivision. Because addition does not care about order,
86
+ `Σ|dᵢ|` is untouched and the box dimension is **still exactly** the stated value. What changes
87
+ is that the curve is no longer exactly self-similar, only statistically so — which averages
88
+ away multifractality and makes these the right target for a plain single-number estimator.
89
+
90
+ **`fixed_*` — 19 signals, one at each dimension.**
91
+ The same legs in fixed order. Identical exact box dimension, but genuinely **multifractal**:
92
+ roughness varies from point to point, so an increment-based estimator will legitimately
93
+ disagree with the box dimension. These test whether your estimator *notices* that one number is
94
+ not enough.
95
+
96
+ An estimator that scores well on `fixed_*` without flagging the disagreement is not measuring
97
+ what it claims to measure.
98
+
99
+ ---
100
+
101
+ ## Contents
102
+
103
+ ```
104
+ data/signals.parquet all 76 signals, 1,495,984 rows, long format:
105
+ signal_id, kind, target_dimension, true_dimension,
106
+ seed, t, value
107
+ data/signals_index.csv 76 rows, one per signal, with the leg coefficients
108
+ ```
109
+
110
+ Dimensions run from **1.05 to 1.95** in steps of 0.05, at 19,684 samples per signal. The `t`
111
+ column is the sample index; samples are evenly spaced by construction, so there is no clock
112
+ time. Sort by `t` within a `signal_id` before measuring.
113
+
114
+ ---
115
+
116
+ ## Loading it
117
+
118
+ ```python
119
+ from datasets import load_dataset
120
+ import numpy as np, pandas as pd
121
+
122
+ ds = load_dataset("Trackertracker2/closed-leg-benchmark", split="train")
123
+ df = ds.to_pandas()
124
+
125
+ # one signal
126
+ g = df[df.signal_id == "shuffled_D1.50_s1"]
127
+ y = g.value.to_numpy()
128
+ print(g.true_dimension.iloc[0]) # 1.500000000000
129
+ ```
130
+
131
+ Scoring your estimator across the whole shuffled set:
132
+
133
+ ```python
134
+ errs = []
135
+ for sid, g in df[df.kind == "shuffled"].groupby("signal_id"):
136
+ y = g.sort_values("t").value.to_numpy().astype(float)
137
+ errs.append(your_estimator(y) - g.true_dimension.iloc[0])
138
+
139
+ errs = np.abs(errs)
140
+ print(f"mean |error| {errs.mean():.4f} worst {errs.max():.4f}")
141
+ ```
142
+
143
+ Straight from parquet, without the `datasets` library:
144
+
145
+ ```python
146
+ df = pd.read_parquet("https://huggingface.co/datasets/Trackertracker2/"
147
+ "closed-leg-benchmark/resolve/main/data/signals.parquet")
148
+ ```
149
+
150
+ ---
151
+
152
+ ## A reference score
153
+
154
+ The estimator in the companion deposit — three variogram-of-order-*p* estimators at
155
+ *p* = ½, 1, 2, taking the median — scores:
156
+
157
+ | set | mean abs. error | worst |
158
+ |---|---|---|
159
+ | `shuffled_*` | **0.021** | 0.093 |
160
+ | `fixed_*` | 0.088 | 0.164 |
161
+
162
+ Its accuracy is **not uniform**. Errors are smallest around *D* = 1.6 and grow toward the top of
163
+ the range, reaching about 0.09 near *D* = 1.95.
164
+
165
+ That degradation is a property of the estimator, not of the benchmark, and surfacing it is the
166
+ point. An estimator that does well at 1.5 and poorly at 1.9 is worth knowing about before you
167
+ trust it on data whose answer you do not have.
168
+
169
+ ---
170
+
171
+ ## Caveats, stated plainly
172
+
173
+ - These are **self-affine graphs**, not general rough signals. An estimator tuned to them may
174
+ still behave differently on physical data. This benchmark tests correctness against known
175
+ ground truth; it does not certify performance in the field.
176
+ - **19,684 points** is a moderate record length. Estimators needing longer series will be
177
+ penalised. That is fair, but it should be said.
178
+ - Large errors on `fixed_*` are **expected**, not failures — those signals are multifractal by
179
+ construction. Read them alongside whatever multifractality diagnostic your tool provides.
180
+ - The signals occupy a **narrow structural class**. Good scores here are necessary for trusting
181
+ an estimator, not sufficient.
182
+
183
+ ---
184
+
185
+ ## Citation
186
+
187
+ The full tool, specification and derivation:
188
+
189
+ - Roughness — a validated measure of texture for ordered signals.
190
+ [10.5281/zenodo.22052384](https://doi.org/10.5281/zenodo.22052384)
191
+ - The Closed-Leg Atlas — a browser for self-affine and self-similar curves.
192
+ [10.5281/zenodo.22040679](https://doi.org/10.5281/zenodo.22040679)
193
+
194
+ ```bibtex
195
+ @software{koch_roughness_2026,
196
+ author = {Koch, W. A.},
197
+ title = {Roughness: a validated measure of texture for ordered signals},
198
+ year = {2026},
199
+ doi = {10.5281/zenodo.22052384},
200
+ url = {https://doi.org/10.5281/zenodo.22052384}
201
+ }
202
+ ```
203
+
204
+ W. A. Koch · [ORCID 0009-0001-1341-7871](https://orcid.org/0009-0001-1341-7871)
205
+
206
+ Prepared with AI assistance for numerical verification and code. Every value in the answer key
207
+ is a closed-form expression, independently recomputed.
data/signals.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dae13d8ed2d9907f17e7f83334166756be0090b5ffc930c4c00c53722ff3cdf9
3
+ size 9170926
data/signals_index.csv ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ signal_id,kind,target_dimension,true_dimension,seed,n_points,leg_1,leg_2,leg_3
2
+ shuffled_D1.05_s1,shuffled,1.05,1.050000000000,1,19684,0.514116827137,-0.028233654275,0.514116827137
3
+ shuffled_D1.05_s2,shuffled,1.05,1.050000000000,2,19684,0.514116827137,-0.028233654275,0.514116827137
4
+ shuffled_D1.05_s3,shuffled,1.05,1.050000000000,3,19684,0.514116827137,-0.028233654275,0.514116827137
5
+ fixed_D1.05,fixed,1.05,1.050000000000,,19684,0.514116827137,-0.028233654275,0.514116827137
6
+ shuffled_D1.10_s1,shuffled,1.10,1.100000000000,1,19684,0.529030793508,-0.058061587017,0.529030793508
7
+ shuffled_D1.10_s2,shuffled,1.10,1.100000000000,2,19684,0.529030793508,-0.058061587017,0.529030793508
8
+ shuffled_D1.10_s3,shuffled,1.10,1.100000000000,3,19684,0.529030793508,-0.058061587017,0.529030793508
9
+ fixed_D1.10,fixed,1.10,1.100000000000,,19684,0.529030793508,-0.058061587017,0.529030793508
10
+ shuffled_D1.15_s1,shuffled,1.15,1.150000000000,1,19684,0.544786911420,-0.089573822841,0.544786911420
11
+ shuffled_D1.15_s2,shuffled,1.15,1.150000000000,2,19684,0.544786911420,-0.089573822841,0.544786911420
12
+ shuffled_D1.15_s3,shuffled,1.15,1.150000000000,3,19684,0.544786911420,-0.089573822841,0.544786911420
13
+ fixed_D1.15,fixed,1.15,1.150000000000,,19684,0.544786911420,-0.089573822841,0.544786911420
14
+ shuffled_D1.20_s1,shuffled,1.20,1.200000000000,1,19684,0.561432734904,-0.122865469808,0.561432734904
15
+ shuffled_D1.20_s2,shuffled,1.20,1.200000000000,2,19684,0.561432734904,-0.122865469808,0.561432734904
16
+ shuffled_D1.20_s3,shuffled,1.20,1.200000000000,3,19684,0.561432734904,-0.122865469808,0.561432734904
17
+ fixed_D1.20,fixed,1.20,1.200000000000,,19684,0.561432734904,-0.122865469808,0.561432734904
18
+ shuffled_D1.25_s1,shuffled,1.25,1.250000000000,1,19684,0.579018503238,-0.158037006476,0.579018503238
19
+ shuffled_D1.25_s2,shuffled,1.25,1.250000000000,2,19684,0.579018503238,-0.158037006476,0.579018503238
20
+ shuffled_D1.25_s3,shuffled,1.25,1.250000000000,3,19684,0.579018503238,-0.158037006476,0.579018503238
21
+ fixed_D1.25,fixed,1.25,1.250000000000,,19684,0.579018503238,-0.158037006476,0.579018503238
22
+ shuffled_D1.30_s1,shuffled,1.30,1.300000000000,1,19684,0.597597292579,-0.195194585158,0.597597292579
23
+ shuffled_D1.30_s2,shuffled,1.30,1.300000000000,2,19684,0.597597292579,-0.195194585158,0.597597292579
24
+ shuffled_D1.30_s3,shuffled,1.30,1.300000000000,3,19684,0.597597292579,-0.195194585158,0.597597292579
25
+ fixed_D1.30,fixed,1.30,1.300000000000,,19684,0.597597292579,-0.195194585158,0.597597292579
26
+ shuffled_D1.35_s1,shuffled,1.35,1.350000000000,1,19684,0.617225176150,-0.234450352300,0.617225176150
27
+ shuffled_D1.35_s2,shuffled,1.35,1.350000000000,2,19684,0.617225176150,-0.234450352300,0.617225176150
28
+ shuffled_D1.35_s3,shuffled,1.35,1.350000000000,3,19684,0.617225176150,-0.234450352300,0.617225176150
29
+ fixed_D1.35,fixed,1.35,1.350000000000,,19684,0.617225176150,-0.234450352300,0.617225176150
30
+ shuffled_D1.40_s1,shuffled,1.40,1.400000000000,1,19684,0.637961393479,-0.275922786958,0.637961393479
31
+ shuffled_D1.40_s2,shuffled,1.40,1.400000000000,2,19684,0.637961393479,-0.275922786958,0.637961393479
32
+ shuffled_D1.40_s3,shuffled,1.40,1.400000000000,3,19684,0.637961393479,-0.275922786958,0.637961393479
33
+ fixed_D1.40,fixed,1.40,1.400000000000,,19684,0.637961393479,-0.275922786958,0.637961393479
34
+ shuffled_D1.45_s1,shuffled,1.45,1.450000000000,1,19684,0.659868529190,-0.319737058379,0.659868529190
35
+ shuffled_D1.45_s2,shuffled,1.45,1.450000000000,2,19684,0.659868529190,-0.319737058379,0.659868529190
36
+ shuffled_D1.45_s3,shuffled,1.45,1.450000000000,3,19684,0.659868529190,-0.319737058379,0.659868529190
37
+ fixed_D1.45,fixed,1.45,1.450000000000,,19684,0.659868529190,-0.319737058379,0.659868529190
38
+ shuffled_D1.50_s1,shuffled,1.50,1.500000000000,1,19684,0.683012701892,-0.366025403784,0.683012701892
39
+ shuffled_D1.50_s2,shuffled,1.50,1.500000000000,2,19684,0.683012701892,-0.366025403784,0.683012701892
40
+ shuffled_D1.50_s3,shuffled,1.50,1.500000000000,3,19684,0.683012701892,-0.366025403784,0.683012701892
41
+ fixed_D1.50,fixed,1.50,1.500000000000,,19684,0.683012701892,-0.366025403784,0.683012701892
42
+ shuffled_D1.55_s1,shuffled,1.55,1.550000000000,1,19684,0.707463763736,-0.414927527472,0.707463763736
43
+ shuffled_D1.55_s2,shuffled,1.55,1.550000000000,2,19684,0.707463763736,-0.414927527472,0.707463763736
44
+ shuffled_D1.55_s3,shuffled,1.55,1.550000000000,3,19684,0.707463763736,-0.414927527472,0.707463763736
45
+ fixed_D1.55,fixed,1.55,1.550000000000,,19684,0.707463763736,-0.414927527472,0.707463763736
46
+ shuffled_D1.60_s1,shuffled,1.60,1.600000000000,1,19684,0.733295511233,-0.466591022466,0.733295511233
47
+ shuffled_D1.60_s2,shuffled,1.60,1.600000000000,2,19684,0.733295511233,-0.466591022466,0.733295511233
48
+ shuffled_D1.60_s3,shuffled,1.60,1.600000000000,3,19684,0.733295511233,-0.466591022466,0.733295511233
49
+ fixed_D1.60,fixed,1.60,1.600000000000,,19684,0.733295511233,-0.466591022466,0.733295511233
50
+ shuffled_D1.65_s1,shuffled,1.65,1.650000000000,1,19684,0.760585907986,-0.521171815973,0.760585907986
51
+ shuffled_D1.65_s2,shuffled,1.65,1.650000000000,2,19684,0.760585907986,-0.521171815973,0.760585907986
52
+ shuffled_D1.65_s3,shuffled,1.65,1.650000000000,3,19684,0.760585907986,-0.521171815973,0.760585907986
53
+ fixed_D1.65,fixed,1.65,1.650000000000,,19684,0.760585907986,-0.521171815973,0.760585907986
54
+ shuffled_D1.70_s1,shuffled,1.70,1.700000000000,1,19684,0.789417319994,-0.578834639987,0.789417319994
55
+ shuffled_D1.70_s2,shuffled,1.70,1.700000000000,2,19684,0.789417319994,-0.578834639987,0.789417319994
56
+ shuffled_D1.70_s3,shuffled,1.70,1.700000000000,3,19684,0.789417319994,-0.578834639987,0.789417319994
57
+ fixed_D1.70,fixed,1.70,1.700000000000,,19684,0.789417319994,-0.578834639987,0.789417319994
58
+ shuffled_D1.75_s1,shuffled,1.75,1.750000000000,1,19684,0.819876764239,-0.639753528477,0.819876764239
59
+ shuffled_D1.75_s2,shuffled,1.75,1.750000000000,2,19684,0.819876764239,-0.639753528477,0.819876764239
60
+ shuffled_D1.75_s3,shuffled,1.75,1.750000000000,3,19684,0.819876764239,-0.639753528477,0.819876764239
61
+ fixed_D1.75,fixed,1.75,1.750000000000,,19684,0.819876764239,-0.639753528477,0.819876764239
62
+ shuffled_D1.80_s1,shuffled,1.80,1.800000000000,1,19684,0.852056171320,-0.704112342640,0.852056171320
63
+ shuffled_D1.80_s2,shuffled,1.80,1.800000000000,2,19684,0.852056171320,-0.704112342640,0.852056171320
64
+ shuffled_D1.80_s3,shuffled,1.80,1.800000000000,3,19684,0.852056171320,-0.704112342640,0.852056171320
65
+ fixed_D1.80,fixed,1.80,1.800000000000,,19684,0.852056171320,-0.704112342640,0.852056171320
66
+ shuffled_D1.85_s1,shuffled,1.85,1.850000000000,1,19684,0.886052662910,-0.772105325821,0.886052662910
67
+ shuffled_D1.85_s2,shuffled,1.85,1.850000000000,2,19684,0.886052662910,-0.772105325821,0.886052662910
68
+ shuffled_D1.85_s3,shuffled,1.85,1.850000000000,3,19684,0.886052662910,-0.772105325821,0.886052662910
69
+ fixed_D1.85,fixed,1.85,1.850000000000,,19684,0.886052662910,-0.772105325821,0.886052662910
70
+ shuffled_D1.90_s1,shuffled,1.90,1.900000000000,1,19684,0.921968844881,-0.843937689761,0.921968844881
71
+ shuffled_D1.90_s2,shuffled,1.90,1.900000000000,2,19684,0.921968844881,-0.843937689761,0.921968844881
72
+ shuffled_D1.90_s3,shuffled,1.90,1.900000000000,3,19684,0.921968844881,-0.843937689761,0.921968844881
73
+ fixed_D1.90,fixed,1.90,1.900000000000,,19684,0.921968844881,-0.843937689761,0.921968844881
74
+ shuffled_D1.95_s1,shuffled,1.95,1.950000000000,1,19684,0.959913116980,-0.919826233960,0.959913116980
75
+ shuffled_D1.95_s2,shuffled,1.95,1.950000000000,2,19684,0.959913116980,-0.919826233960,0.959913116980
76
+ shuffled_D1.95_s3,shuffled,1.95,1.950000000000,3,19684,0.959913116980,-0.919826233960,0.959913116980
77
+ fixed_D1.95,fixed,1.95,1.950000000000,,19684,0.959913116980,-0.919826233960,0.959913116980