Python API reference¶
Generated with mkdocstrings from package docstrings.
Install the package and docs extras: pip install -e ".[docs]".
Runner¶
lrdbench.runner.BenchmarkRunner
¶
Orchestrate a complete benchmark run.
The runner implements the full benchmark loop:
- Load and validate the manifest.
- Materialise records from generators or observational sources.
- Optionally train data-driven estimators.
- Fit every enrolled estimator to every record.
- Evaluate mode-appropriate metrics.
- Build leaderboards.
- Persist results to a :class:
CsvResultStore. - Generate HTML/CSV/LaTeX report artefacts.
Example::
from lrdbench.runner import BenchmarkRunner
from lrdbench.manifest import load_manifest
runner = BenchmarkRunner()
manifest = load_manifest("my_suite.yaml")
output = runner.run(manifest)
print(output.run_id)
Source code in src/lrdbench/runner.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
run(manifest, *, manifest_path=None, base_dir=None)
¶
Execute the full benchmark loop for manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
BenchmarkManifest
|
A validated :class: |
required |
manifest_path
|
Path | None
|
Path to the manifest file, used to resolve relative paths (e.g. observational CSV files). |
None
|
base_dir
|
Path | None
|
Alternative directory for relative path resolution.
If |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
BenchmarkRunOutput
|
class: |
BenchmarkRunOutput
|
estimates, metrics, leaderboards, and report bundle. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the manifest mode is not supported. |
ValueError
|
If the manifest requests unsupported generator
parameters (e.g. ARFIMA with |
Source code in src/lrdbench/runner.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
preview(manifest, *, manifest_path=None, base_dir=None)
¶
Dry-run preview: materialise records and report grid size without fitting.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Dictionary with |
dict[str, object]
|
|
Source code in src/lrdbench/runner.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |
__init__(*, generators=None, estimators=None, contaminations=None, preprocessing=None, discover_plugins=True)
¶
Source code in src/lrdbench/runner.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
lrdbench.runner.run_manifest_path(path, *, discover_plugins=True)
¶
Convenience entry-point: load a manifest from disk and run it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Filesystem path to a YAML manifest. |
required |
discover_plugins
|
bool
|
Whether to auto-discover third-party estimator plugins via environment variables. |
True
|
Returns:
| Type | Description |
|---|---|
BenchmarkRunOutput
|
The completed benchmark run output. |
Source code in src/lrdbench/runner.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 | |
lrdbench.runner.run_manifest_mapping(data, *, base_dir=None, discover_plugins=True)
¶
Convenience entry-point: run a benchmark from an in-memory dictionary.
This is useful for programmatic benchmark construction or testing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dictionary matching the manifest schema. |
required |
base_dir
|
Path | None
|
Directory used to resolve relative paths (e.g. CSV files). |
None
|
discover_plugins
|
bool
|
Whether to auto-discover third-party estimator plugins via environment variables. |
True
|
Returns:
| Type | Description |
|---|---|
BenchmarkRunOutput
|
The completed benchmark run output. |
Source code in src/lrdbench/runner.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | |
Manifest¶
lrdbench.manifest.load_manifest(path)
¶
Source code in src/lrdbench/manifest.py
110 111 | |
lrdbench.manifest.manifest_from_mapping(data)
¶
Source code in src/lrdbench/manifest.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
Estimator interface¶
lrdbench.interfaces.BaseEstimator
¶
Bases: ABC
Abstract base for long-range dependence estimators.
All estimators enrolled in a benchmark must implement this interface.
The :meth:fit method receives a :class:SeriesRecord and must return
an :class:EstimateResult containing at minimum a point estimate and
a validity flag.
Source code in src/lrdbench/interfaces.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
spec
abstractmethod
property
¶
The estimator's specification (normally an :class:EstimatorSpec).
fit(record)
abstractmethod
¶
Compute an estimate for the given record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
SeriesRecord
|
The time-series record to analyse. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
An |
EstimateResult
|
class: |
EstimateResult
|
confidence intervals, diagnostics, and runtime. |
Source code in src/lrdbench/interfaces.py
175 176 177 178 179 180 181 182 183 184 185 186 | |
lrdbench.interfaces.BaseGenerator
¶
Bases: ABC
Abstract base for synthetic time-series generators.
Each generator produces a :class:SeriesRecord from a parameter dictionary
and an optional seed. The family property is the registry key used in
manifest source blocks (e.g. fGn, ARFIMA).
Source code in src/lrdbench/interfaces.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
family
abstractmethod
property
¶
Registry key for this generator (e.g. 'fGn', 'ARFIMA').
version
abstractmethod
property
¶
Human-readable version string for provenance tracking.
generate(*, record_id, params, seed, manifest_id)
abstractmethod
¶
Generate a single synthetic record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record_id
|
str
|
Stable identifier for the record. |
required |
params
|
Mapping[str, Any]
|
Generator-specific parameters (e.g. |
required |
seed
|
int | None
|
Optional RNG seed for reproducibility. |
required |
manifest_id
|
str | None
|
Manifest identifier to embed in provenance. |
required |
Returns:
| Type | Description |
|---|---|
SeriesRecord
|
A fully populated :class: |
Source code in src/lrdbench/interfaces.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
lrdbench.interfaces.BaseContamination
¶
Bases: ABC
Abstract base for contamination operators.
A contamination operator transforms a :class:SeriesRecord into a new,
modified record (e.g. by adding outliers, level shifts, or trends).
The original record must remain untouched; the returned record should
carry an updated :attr:contamination_history.
Source code in src/lrdbench/interfaces.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
name
abstractmethod
property
¶
Registry key for this operator (e.g. 'outliers', 'level_shift').
family
abstractmethod
property
¶
Broad operator category (e.g. 'artefact', 'trend').
version
abstractmethod
property
¶
Human-readable version string for provenance tracking.
apply(record, *, params, seed, manifest_id, new_record_id)
abstractmethod
¶
Apply contamination to record and return a new record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
SeriesRecord
|
The clean input record. |
required |
params
|
Mapping[str, Any]
|
Operator-specific parameters (e.g. |
required |
seed
|
int | None
|
Optional RNG seed for stochastic operators. |
required |
manifest_id
|
str | None
|
Manifest identifier to embed in provenance. |
required |
new_record_id
|
str
|
Identifier for the resulting contaminated record. |
required |
Returns:
| Type | Description |
|---|---|
SeriesRecord
|
A new :class: |
SeriesRecord
|
contamination history. |
Source code in src/lrdbench/interfaces.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
lrdbench.interfaces.BasePreprocessing
¶
Bases: ABC
Abstract base for preprocessing and correction operators.
A preprocessing operator transforms a :class:SeriesRecord into a new
record before estimation. Unlike contaminations, these operators represent
correction hypotheses, including empirical corrections such as rolling
z-scoring and simulation oracles that use latent components.
Source code in src/lrdbench/interfaces.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
name
abstractmethod
property
¶
Registry key for this operator (e.g. 'rolling_zscore').
family
abstractmethod
property
¶
Broad correction category (e.g. 'empirical_variance').
kind
abstractmethod
property
¶
Correction kind, normally 'empirical' or 'oracle'.
version
abstractmethod
property
¶
Human-readable version string for provenance tracking.
apply(record, *, params, seed, manifest_id, new_record_id)
abstractmethod
¶
Apply preprocessing to record and return a new record.
Source code in src/lrdbench/interfaces.py
146 147 148 149 150 151 152 153 154 155 156 157 | |
Bundled temporal estimators¶
lrdbench.estimators.temporal.RSEstimator
¶
Bases: BaseEstimator
Rescaled-range Hurst proxy with optional block-bootstrap CIs.
Parameters read from params:
n_bootstrap(int, default 200) – number of bootstrap replicates.bootstrap_block_len(int, defaultmax(4, n//10)) – block length.ci_levels(list, default[0.95]) – nominal coverage levels.min_scale(int, default 8) – minimum R/S subseries length.max_scale(int, optional) – maximum R/S subseries length.scale_ratio(float, default 1.5) – geometric scale spacing.use_anis_lloyd_correction(bool, defaultFalse) – ifTrue, divide each scale's average R/S value by the Anis-Lloyd white-noise expectation before fitting the slope, then add the 0.5 white-noise baseline back to the fitted slope.
Source code in src/lrdbench/estimators/temporal.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
lrdbench.estimators.temporal.DFAEstimator
¶
Bases: BaseEstimator
Detrended fluctuation analysis (DFA) scaling exponent as a Hurst proxy.
Source code in src/lrdbench/estimators/temporal.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
lrdbench.estimators.temporal.DMAEstimator
¶
Bases: BaseEstimator
Detrended moving-average fluctuation scaling (Hurst proxy).
Source code in src/lrdbench/estimators/temporal.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
lrdbench.estimators.temporal.AbsoluteMomentEstimator
¶
Bases: BaseEstimator
Absolute first moment of aggregated series as a Hurst proxy.
Source code in src/lrdbench/estimators/temporal.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | |
lrdbench.estimators.temporal.VarianceEstimator
¶
Bases: BaseEstimator
Variance of aggregated series as a Hurst proxy.
Source code in src/lrdbench/estimators/temporal.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | |
lrdbench.estimators.temporal.VarianceResidualEstimator
¶
Bases: BaseEstimator
Variance of block residuals as a Hurst proxy.
Source code in src/lrdbench/estimators/temporal.py
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | |
Bundled spectral estimators¶
lrdbench.estimators.spectral.GPHEstimator
¶
Bases: BaseEstimator
Geweke–Porter–Hudak log-periodogram regression for long-memory parameter d.
Source code in src/lrdbench/estimators/spectral.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
lrdbench.estimators.spectral.PeriodogramRegressionEstimator
¶
Bases: BaseEstimator
Log-periodogram regression (memory parameter d, GPH-type).
Source code in src/lrdbench/estimators/spectral.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
lrdbench.estimators.spectral.PeriodogramBetaEstimator
¶
Bases: BaseEstimator
Low-frequency spectral-exponent (beta) estimator, S(f) ~ f^(-beta).
Shares the log-periodogram regression core with GPH/Periodogram but declares
the spectral_exponent_beta estimand, reporting beta = 2d so a suite
can benchmark the spectral slope directly against a beta ground truth on the
same realisation used for Hurst estimation. The default frequency count is
the shared m = sqrt(n). Bandwidth controls the bias-variance tradeoff;
the former factor-of-two error was an implementation defect, not bandwidth bias.
Source code in src/lrdbench/estimators/spectral.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
lrdbench.estimators.spectral.WhittleMLEEstimator
¶
Bases: BaseEstimator
Gaussian Whittle likelihood for ARFIMA(0,d,0) spectral density.
Source code in src/lrdbench/estimators/spectral.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
lrdbench.estimators.spectral.ModifiedLocalWhittleEstimator
¶
Bases: BaseEstimator
Ordinary Gaussian local Whittle, retaining the legacy registry name.
No taper, differencing or nonstationary correction is implemented.
Source code in src/lrdbench/estimators/spectral.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
Bundled timescale estimators¶
lrdbench.estimators.timescale.ACFDecayEstimator
¶
Bases: BaseEstimator
Autocorrelation-decay timescale tau (log-linear ACF fit).
Targets the timescale_tau estimand, reporting the exponential decay
constant in samples. Correctly specified for AR(1)/OU-type single-timescale
dynamics; deliberately misspecified (and thus window-dependent) under true
long-range dependence.
Source code in src/lrdbench/estimators/timescale.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
Bundled geometric estimators¶
lrdbench.estimators.geometric.HiguchiEstimator
¶
Bases: BaseEstimator
Higuchi fractal length curve; Hurst proxy H ≈ 2 − D for the time-series graph.
Source code in src/lrdbench/estimators/geometric.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
lrdbench.estimators.geometric.GHEEstimator
¶
Bases: BaseEstimator
Generalized Hurst estimator: scaling of absolute q-th path increments.
Parameters read from params:
n_scales(int, default 16) – number of geometric lags.h_min(int, default 1) – minimum lag in samples.h_max(int, default path length // 8) – maximum lag in samples.q(float, default 2) – positive moment order, e.g. 1 for absolute increments.input_representation(defaultpath) –incrementsintegrates first.flat_slope_tol– only zero is accepted; the old heuristic is removed.
Source code in src/lrdbench/estimators/geometric.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
Bundled wavelet estimators¶
lrdbench.estimators.wavelet.WaveletOLSEstimator
¶
Bases: BaseEstimator
Plain OLS on log2 wavelet detail variances vs scale index (log-scale regression).
Source code in src/lrdbench/estimators/wavelet.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
lrdbench.estimators.wavelet.WaveletAbryVeitchEstimator
¶
Bases: BaseEstimator
Abry–Veitch-type log-scale regression on wavelet detail variances (Hurst proxy).
Source code in src/lrdbench/estimators/wavelet.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
lrdbench.estimators.wavelet.WaveletBardetEstimator
¶
Bases: BaseEstimator
Weighted log-scale regression (Bardet-type wavelet Hurst proxy).
Source code in src/lrdbench/estimators/wavelet.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
lrdbench.estimators.wavelet.WaveletJensenEstimator
¶
Bases: BaseEstimator
Two-band wavelet slope extrapolation (Jensen-style bias reduction).
Source code in src/lrdbench/estimators/wavelet.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
lrdbench.estimators.wavelet.WaveletWhittleEstimator
¶
Bases: BaseEstimator
Wavelet-domain Gaussian Whittle-type fit to detail variances across scales.
Source code in src/lrdbench/estimators/wavelet.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
Bundled data-driven estimators¶
lrdbench.estimators.data_driven.MLRandomForestEstimator
¶
Bases: _SklearnEstimator
Source code in src/lrdbench/estimators/data_driven.py
322 323 | |
lrdbench.estimators.data_driven.MLSVREstimator
¶
Bases: _SklearnEstimator
Source code in src/lrdbench/estimators/data_driven.py
326 327 | |
lrdbench.estimators.data_driven.MLCNNEstimator
¶
Bases: _TorchSequenceEstimator
Source code in src/lrdbench/estimators/data_driven.py
420 421 | |
lrdbench.estimators.data_driven.MLLSTMEstimator
¶
Bases: _TorchSequenceEstimator
Source code in src/lrdbench/estimators/data_driven.py
424 425 | |
LRD discriminators¶
These target the decision estimand lrd_class and emit a [0, 1] score scored by the
classification metric family (roc_auc, balanced_accuracy, true_positive_rate,
false_positive_rate).
lrdbench.estimators.discrimination.ThresholdHurstDiscriminator
¶
Bases: BaseEstimator
Baseline LRD discriminator: logistic squash of a Hurst estimate.
Parameters (parameter_schema): base in {dfa, gph, rs}
(default dfa), h0 decision centre (default 0.55), width logistic
scale (default 0.05). Score = sigmoid((H - h0) / width) in [0, 1].
Source code in src/lrdbench/estimators/discrimination.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
lrdbench.estimators.discrimination.LowFreqSpectralDiscriminator
¶
Bases: BaseEstimator
LRD discriminator from the low-frequency memory parameter (local Whittle).
Source code in src/lrdbench/estimators/discrimination.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
lrdbench.estimators.discrimination.ScaleCrossoverDiscriminator
¶
Bases: BaseEstimator
LRD discriminator from scale-invariance of the DFA exponent (crossover).
Source code in src/lrdbench/estimators/discrimination.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
lrdbench.estimators.discrimination.ICModelSelectDiscriminator
¶
Bases: BaseEstimator
LRD discriminator from BIC model comparison (ARFIMA(0,d,0) vs AR(p)).
Source code in src/lrdbench/estimators/discrimination.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
Registries¶
lrdbench.registries.EstimatorRegistry
¶
Bases: Registry[EstimatorBuilder]
Callable(spec: EstimatorSpec) -> BaseEstimator.
Source code in src/lrdbench/registries.py
48 49 50 51 | |
lrdbench.registries.GeneratorRegistry
¶
Bases: Registry[BaseGenerator]
Source code in src/lrdbench/registries.py
33 34 | |
lrdbench.registries.ContaminationRegistry
¶
Bases: Registry[BaseContamination]
Source code in src/lrdbench/registries.py
37 38 | |
lrdbench.registries.PreprocessingRegistry
¶
Bases: Registry[BasePreprocessing]
Source code in src/lrdbench/registries.py
41 42 | |
Defaults¶
lrdbench.defaults.build_default_estimator_registry()
¶
Source code in src/lrdbench/defaults.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
lrdbench.defaults.build_default_generator_registry()
¶
Source code in src/lrdbench/defaults.py
71 72 73 74 75 76 77 78 79 80 | |
lrdbench.defaults.build_default_contamination_registry()
¶
Source code in src/lrdbench/defaults.py
83 84 85 86 87 88 89 90 91 | |
lrdbench.defaults.build_default_preprocessing_registry()
¶
Source code in src/lrdbench/defaults.py
94 95 96 97 98 99 100 101 | |
Schema dataclasses¶
lrdbench.schema.BenchmarkManifest
dataclass
¶
Source code in src/lrdbench/schema.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
lrdbench.schema.SeriesRecord
dataclass
¶
Source code in src/lrdbench/schema.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
lrdbench.schema.TruthSpec
dataclass
¶
Source code in src/lrdbench/schema.py
12 13 14 15 16 17 18 19 | |
lrdbench.schema.ProvenanceRecord
dataclass
¶
Source code in src/lrdbench/schema.py
33 34 35 36 37 38 39 40 41 42 | |
lrdbench.schema.TransformationRecord
dataclass
¶
Source code in src/lrdbench/schema.py
22 23 24 25 26 27 28 29 30 | |
lrdbench.schema.ArtefactRecord
dataclass
¶
Source code in src/lrdbench/schema.py
202 203 204 205 206 207 208 209 210 211 | |
lrdbench.schema.EstimateResult
dataclass
¶
Source code in src/lrdbench/schema.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
lrdbench.schema.EstimatorSpec
dataclass
¶
Source code in src/lrdbench/schema.py
81 82 83 84 85 86 87 88 89 90 91 92 | |
lrdbench.schema.MetricSpec
dataclass
¶
Definition of a benchmark metric.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Machine-readable metric identifier (e.g. |
symbol |
str
|
Short symbol for tables (e.g. |
requires_truth |
bool
|
Whether the metric needs a ground-truth target value. |
admissible_modes |
tuple[BenchmarkMode, ...]
|
Benchmark modes where this metric is valid. |
aggregation_rule |
str
|
How stratum-level values are combined (e.g.
|
optimisation_direction |
OptimisationDirection
|
Whether lower or higher values are better. |
unit |
str | None
|
Optional unit string for reporting. |
null_policy |
str
|
How missing values are handled. |
nominal_levels |
tuple[float, ...]
|
Coverage levels (e.g. |
parameters |
Mapping[str, Any]
|
Extra metric-specific parameters. |
Source code in src/lrdbench/schema.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
lrdbench.schema.MetricValue
dataclass
¶
Source code in src/lrdbench/schema.py
149 150 151 152 153 154 155 156 157 | |
lrdbench.schema.MetricBundle
dataclass
¶
Source code in src/lrdbench/schema.py
160 161 162 163 164 165 | |
lrdbench.schema.LeaderboardSpec
dataclass
¶
Source code in src/lrdbench/schema.py
168 169 170 171 172 173 174 175 | |
lrdbench.schema.LeaderboardRow
dataclass
¶
Source code in src/lrdbench/schema.py
178 179 180 181 182 183 184 185 | |
lrdbench.schema.ReportSpec
dataclass
¶
Source code in src/lrdbench/schema.py
188 189 190 191 192 193 194 195 196 197 198 199 | |
lrdbench.schema.ReportBundle
dataclass
¶
Source code in src/lrdbench/schema.py
214 215 216 217 218 219 220 221 222 223 224 225 | |
lrdbench.schema.BenchmarkRunOutput
dataclass
¶
Source code in src/lrdbench/schema.py
248 249 250 251 252 253 254 255 256 257 | |
lrdbench.schema.PluginProvenanceRecord
dataclass
¶
Source code in src/lrdbench/schema.py
45 46 47 48 49 50 51 52 53 | |
Validation and contracts¶
lrdbench.validation.validate_manifest(manifest, *, strict_unknown_keys=True)
¶
Source code in src/lrdbench/validation.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | |
lrdbench.validation.validate_metric_admissibility(metric_spec, mode, record=None)
¶
Source code in src/lrdbench/validation.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
lrdbench.validation.validate_truth_compatibility(estimator_spec, record)
¶
Source code in src/lrdbench/validation.py
274 275 276 277 278 279 280 281 282 283 | |
lrdbench.validation.truth_for(record, estimand)
¶
Return the truth on record matching estimand.
The primary record.truth is checked first, then additional_truths.
A record may carry ground truth for several estimands (e.g. Hurst, spectral
exponent, timescale) defined on the same realisation; each estimator is
scored against the truth for its own target_estimand.
Source code in src/lrdbench/validation.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
lrdbench.output_contract.public_output_contract()
¶
Source code in src/lrdbench/output_contract.py
206 207 | |
lrdbench.output_contract.required_output_files()
¶
Source code in src/lrdbench/output_contract.py
210 211 212 | |
lrdbench.output_contract.validate_output_contract(run_root)
¶
Source code in src/lrdbench/output_contract.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
Bootstrap utilities¶
lrdbench.bootstrap.circular_block_resample(x, rng, block_len)
¶
Circular block bootstrap resample of the same length as x.
The series is treated as circular (wrap-around at the boundaries) to avoid edge artefacts. Blocks are concatenated until the desired length is reached, then truncated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
1-D input array. |
required |
rng
|
Generator
|
NumPy random generator instance. |
required |
block_len
|
int
|
Block length in samples. Clamped to |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A resampled array of the same shape as |
Source code in src/lrdbench/bootstrap.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
lrdbench.bootstrap.bootstrap_statistic_distribution(x, rng, statistic, *, n_boot, block_len, diagnostics=None)
¶
Compute a bootstrap distribution for statistic using circular block resampling.
Only finite replicate values are retained. Every attempted draw is counted;
invalid values and exceptions are recorded separately in diagnostics.
When no diagnostics sink is supplied, discarded draws emit a warning.
This accounting does not establish statistical validity of the bootstrap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
1-D input array (the original time series). |
required |
rng
|
Generator
|
NumPy random generator instance. |
required |
statistic
|
Callable[[ndarray], float | None]
|
Function that takes a 1-D array and returns a scalar or |
required |
n_boot
|
int
|
Nonnegative number of bootstrap replicates; zero disables resampling. |
required |
block_len
|
int
|
Block length in samples. A common pragmatic default is
|
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
1-D array of finite bootstrap replicates. |
Source code in src/lrdbench/bootstrap.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
lrdbench.bootstrap.symmetric_percentile_cis(samples, alphas)
¶
Symmetric percentile confidence intervals from bootstrap samples.
For each nominal level alpha the interval is
[q_{(1-alpha)/2}, q_{1-(1-alpha)/2}] where q denotes the sample
quantile of the bootstrap distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samples
|
ndarray
|
1-D array of bootstrap replicates (e.g. from
:func: |
required |
alphas
|
tuple[float, ...]
|
Nominal coverage levels (e.g. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
Tuple of |
...
|
Empty if |
Source code in src/lrdbench/bootstrap.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
Plugin discovery¶
lrdbench.plugin_loader.PluginDiscoveryResult
¶
Immutable record produced by a single plugin load attempt.
Source code in src/lrdbench/plugin_loader.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
lrdbench.plugin_loader.discover_plugins_from_env()
¶
Read LRD_BENCH_ESTIMATOR_PLUGIN and LRD_BENCH_ESTIMATOR_PLUGIN_PATH
and return all discovered (success or failure) results.
Source code in src/lrdbench/plugin_loader.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
lrdbench.plugin_loader.build_estimator_registry_with_plugins(*, base_registry=None, plugin_results=None)
¶
Build an estimator registry, optionally including third-party plugins.
Returns the combined registry alongside the final plugin discovery results. Built-in estimators take precedence when names collide.
Source code in src/lrdbench/plugin_loader.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
Packaged assets and testing helpers¶
lrdbench.public_assets.list_public_suites()
¶
Source code in src/lrdbench/public_assets.py
23 24 25 26 27 28 29 30 31 32 33 34 35 | |
lrdbench.public_assets.resolve_manifest_argument(value)
¶
Source code in src/lrdbench/public_assets.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
lrdbench.testing.estimator_spec(*, name='CandidateEstimator', family='external', target_estimand='hurst_scaling_proxy', assumptions=(), supports_ci=False, supports_diagnostics=True, params=None, version=None)
¶
Source code in src/lrdbench/testing.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
lrdbench.testing.synthetic_series_record(values, *, record_id='test_record', source_name='test')
¶
Source code in src/lrdbench/testing.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
lrdbench.testing.smoke_fit_estimator(estimator, values, *, min_value=None, max_value=None)
¶
Source code in src/lrdbench/testing.py
73 74 75 76 77 78 79 80 81 82 | |
lrdbench.testing.assert_valid_estimate(result, *, min_value=None, max_value=None)
¶
Source code in src/lrdbench/testing.py
50 51 52 53 54 55 56 57 58 59 60 61 62 | |
lrdbench.testing.assert_invalid_estimate(result, *, reason_contains=None)
¶
Source code in src/lrdbench/testing.py
65 66 67 68 69 70 | |