Skip to content

Benchmark Industrial Migration

v1docq edited this page Jul 14, 2026 · 1 revision

Переход от benchmark.v2 к benchmark.industrial

Эта страница перенесена из документации репозитория, чтобы справочные материалы по методам, экспериментам и бенчмаркам жили в wiki, а не в кодовой ветке.


Источник: docs/benchmark_v2/quickstart.md

Benchmark Industrial Quickstart

This page replaces the old benchmark.v2 quickstart. The runtime package for new benchmark work is now benchmark.industrial.

Historical folders such as benchmark/results/v2_kernel_learning may still be used as data sources, but they are not import targets.

Fastest Path

The simplest way to run the benchmark stack is through presets.

Python API

from benchmark.industrial import run_local_benchmark_preset

result = run_local_benchmark_preset(
    "m4",
    subset="daily",
    sample_size=2,
    persist_on_run=True,
    output_dir="benchmark/results/industrial_demo/m4_daily",
)

Package CLI

python -m benchmark.industrial m4 --subset daily --sample-size 2 --output-dir benchmark/results/industrial_demo/m4_daily

Forecasting Presets

Supported preset names:

  • m4
  • monash

Example:

from benchmark.industrial import run_local_benchmark_preset

result = run_local_benchmark_preset(
    "monash",
    dataset_name="Bitcoin",
    subset="daily",
    sample_size=2,
    persist_on_run=True,
    output_dir="benchmark/results/industrial_demo/monash_bitcoin",
)

Classification And Regression Presets

from benchmark.industrial import run_local_benchmark_preset

tsc_result = run_local_benchmark_preset(
    "ucr",
    dataset_name="Lightning7",
    persist_on_run=True,
    output_dir="benchmark/results/industrial_demo/ucr_lightning7",
)

tser_result = run_local_benchmark_preset(
    "tser",
    dataset_name="NaturalGasPricesSentiment",
    persist_on_run=True,
    output_dir="benchmark/results/industrial_demo/tser_natural_gas",
)

Registered Runs

If every run should be indexed automatically, use the registered entrypoints.

from benchmark.industrial import run_registered_preset

bundle = run_registered_preset(
    "ucr",
    dataset_name="Lightning7",
    output_dir="benchmark/results/industrial_study/ucr_lightning7",
    persist_on_run=True,
)

print(bundle.registry_entry_path)
print(bundle.summary_path)

Manifest Workflow

Manifest examples now live under examples/utils/current_api/manifests and use JSON by default.

from benchmark.industrial import run_manifest_path

result = run_manifest_path("examples/utils/current_api/manifests/m4_daily_preset.json")

To inspect the resolved manifest without running training:

from benchmark.industrial import load_manifest, render_resolved_manifest

payload = load_manifest("examples/utils/current_api/manifests/m4_daily_preset.json")
resolved = render_resolved_manifest(payload)

CLI usage:

python -m benchmark.industrial --manifest examples/utils/current_api/manifests/m4_daily_preset.json
python -m benchmark.industrial --manifest examples/utils/current_api/manifests/m4_daily_preset.json --print-resolved-manifest

Run Comparison

To compare multiple registered runs in the same output root:

from benchmark.industrial import compare_registered_runs

comparison = compare_registered_runs(
    "benchmark/results/industrial_study/ucr_lightning7",
    output_dir="benchmark/results/industrial_study/ucr_lightning7/_comparison",
)

This produces registry overview tables, best-model-per-run tables, model-vs-run matrices, markdown summaries, and plots.

Standard Entry Points

Programmatic entrypoints:

  • run_forecasting_benchmark_suite(...)
  • run_tsc_benchmark_suite(...)
  • run_tser_benchmark_suite(...)
  • run_local_benchmark_preset(...)
  • run_manifest(...)
  • run_manifest_path(...)
  • run_registered_preset(...)
  • run_registered_manifest(...)
  • run_registered_manifest_path(...)
  • compare_registered_runs(...)

CLI:

python -m benchmark.industrial <preset> [options]
python -m benchmark.industrial --manifest <path> [options]

Useful Files


Источник: docs/benchmark_v2/migration_guide.md

Migration Guide: Legacy Benchmarks To benchmark.industrial

This document replaces the old Benchmark V2 migration guide. The canonical runtime package is now benchmark.industrial.

Use historical benchmark/results/v2_kernel_learning folders only as result data. Do not import the removed versioned runtime package in new code.

Goal

Migrate from legacy benchmark entrypoints:

  • benchmark/benchmark_TSF.py
  • benchmark/benchmark_TSC.py
  • benchmark/benchmark_TSER.py

into the current typed benchmark stack:

  • typed suite configs;
  • JSON defaults and manifests;
  • registered runs;
  • shared aggregation and visualization;
  • showcase-driven public comparisons.

Old To New Mapping

Forecasting

Old:

from benchmark.benchmark_TSF import BenchmarkTSF

New:

from benchmark.industrial import run_forecasting_benchmark_suite
from benchmark.industrial import run_local_benchmark_preset
from benchmark.industrial import run_manifest_path

Classification

Old:

from benchmark.benchmark_TSC import BenchmarkTSC

New:

from benchmark.industrial import run_tsc_benchmark_suite
from benchmark.industrial import run_local_benchmark_preset

Regression

Old:

from benchmark.benchmark_TSER import BenchmarkTSER

New:

from benchmark.industrial import run_tser_benchmark_suite
from benchmark.industrial import run_local_benchmark_preset

Recommended Migration Path

  1. Stop adding new logic to root-level legacy benchmark files.
  2. Put new runtime code under the relevant benchmark/industrial/<domain> package.
  3. Normalize inputs into BenchmarkSuiteConfig, DatasetSpec, ModelSpec, RunSpec, and ArtifactSpec.
  4. Keep model lists, dataset lists, metrics, and output templates in package-local JSON defaults when they are catalog-like data.
  5. Use run_registered_suite, run_registered_preset, or run_registered_manifest_path for persisted studies.
  6. Use benchmark.industrial.evaluation and benchmark.industrial.visualization for aggregation and plots.
  7. Add public result sources to benchmark/results/showcase/showcase_manifest.json.

Suite Config Example

from benchmark.industrial import ArtifactSpec, BenchmarkSuiteConfig, DatasetSpec, ModelSpec, RunSpec, TaskType

config = BenchmarkSuiteConfig(
    task_type=TaskType.FORECASTING,
    datasets=(DatasetSpec(dataset_name="M4_Daily", source="local_m4", params={"subset": "daily", "sample_size": 2}),),
    models=(ModelSpec(adapter_name="naive_last_value", display_name="NaiveLastValue"),),
    artifact_spec=ArtifactSpec(output_dir="benchmark/results/industrial_demo"),
    run_spec=RunSpec(run_name="forecasting_demo", primary_metric="mae"),
)

Manifest Example

from benchmark.industrial import run_manifest_path

result = run_manifest_path("examples/utils/current_api/manifests/m4_daily_preset.json")

Compatibility Status

benchmark.industrial.legacy contains compatibility wrappers for old flows that still need them. These wrappers may delegate to the current runtime internally, but new code should not copy their ApiTemplate usage or old root-script style.

Related Documents


Источник: docs/benchmark_v2/benchmark_v2_overview.md

Benchmark Industrial Overview

This page is kept in docs/benchmark_v2 as a migration landing page for older links. The active runtime package is benchmark.industrial.

Purpose

benchmark.industrial is the benchmark stack for time series forecasting, classification, and regression in this repository. It provides a typed, reproducible, artifact-oriented workflow with:

  • forecasting on local M4 and Monash subsets;
  • time series classification on local UCR/UEA datasets;
  • time series regression on local TSER datasets;
  • publication-ready artifact packs;
  • manifest-driven execution;
  • registered runs and run-to-run comparison;
  • canonical result showcase generation.

Scope

The current implementation covers:

  • forecasting;
  • ts_classification;
  • ts_regression.

Main Modules

  • benchmark/industrial/core.py: shared dataclasses and task-agnostic result schema.
  • benchmark/industrial/forecasting.py: forecasting adapters, metrics, model adapters, and suite runner.
  • benchmark/industrial/classification.py: TSC adapters, metrics, baselines, and artifact rendering.
  • benchmark/industrial/regression.py: TSER adapters, metrics, baselines, and artifact rendering.
  • benchmark/industrial/evaluation/: aggregation, result analysis, diagnostics, and evolution analysis.
  • benchmark/industrial/visualization/: reusable report and forecast-comparison plots.
  • benchmark/industrial/experiments/: manifests, presets, registry, persistence, and run comparison.
  • benchmark/industrial/cli.py: package CLI used by python -m benchmark.industrial.

Execution Modes

  1. Direct BenchmarkSuiteConfig for full programmatic control.
  2. Presets for quick local runs: m4, monash, ucr, tser.
  3. JSON manifests for reproducible experiment descriptions.
  4. Registered runs for persisted studies and paper-oriented workflows.

Artifact Layout

Registered suite runs should write:

<output_dir>/<run_id>/
  records/
  aggregate/
  resolved_config.json
  resolved_manifest.json
  run_summary.json
  artifact_manifest.json

The public benchmark window is generated from:

python -m benchmark.results.showcase

Related Documents


Источник: docs/benchmark_v2/release_notes.md

Benchmark Industrial Release Notes

These notes supersede the old Benchmark V2 release notes. The active runtime package is benchmark.industrial.

Summary

The benchmark layer now uses one canonical package for forecasting, time series classification, and time series regression. The old versioned runtime name should not be used in new imports.

What Is Included

  • Unified benchmark schema for forecasting, ts_classification, and ts_regression.
  • Local dataset adapters for M4, Monash, UCR/UEA-style classification, and TSER data.
  • JSON manifest-driven execution.
  • Preset-based execution for standard local runs.
  • Registered run bundles with result persistence.
  • Shared aggregation, diagnostics, and visualization modules.
  • Public result showcase under benchmark/results/showcase.
  • Compatibility wrappers under benchmark.industrial.legacy where older flows still need them.

Main User-Facing Entry Points

  • run_forecasting_benchmark_suite(...)
  • run_tsc_benchmark_suite(...)
  • run_tser_benchmark_suite(...)
  • run_local_benchmark_preset(...)
  • run_manifest(...)
  • run_manifest_path(...)
  • run_registered_preset(...)
  • run_registered_manifest(...)
  • run_registered_manifest_path(...)
  • compare_registered_runs(...)

CLI

python -m benchmark.industrial <preset> [options]
python -m benchmark.industrial --manifest <path> [options]

Current Limitations

  • External deep baselines are optional and may be reported as skipped or not_available.
  • Historical result folders can be used as reference data, but they are not runtime modules.
  • The benchmark layer is optimized for local reproducible runs and artifact generation, not as a dashboard product.

Related Documents


Источник: docs/benchmark_v2/forecasting_suite_workflow.md

Forecasting Suite Workflow

Purpose

This document explains the operational workflow of run_forecasting_suite(...) and the two new regime-aware helpers:

  • analyze_regime_diagnostics(...)
  • recommend_forecasting_model(...)

The goal is to give external contributors a compact mental model of the forecasting benchmark runtime, the main extension points, and the data contracts that flow through the system.

Table of Contents

  1. Entry Point
  2. High-Level Workflow
  3. Stage-by-Stage Breakdown
  4. Core Runtime Objects
  5. Diagnostics and Routing
  6. Metrics and Records
  7. Failure and Optional-Model Paths
  8. Developer Hints
  9. Common Pitfalls

Entry Point

Primary runtime entry point:

  • run_forecasting_suite(...)

Typical orchestration wrapper:

  • run_forecasting_benchmark_suite(...)

Important supporting modules:

  • dataset/model contracts: core.py
  • publication artifacts: analytics.py
  • progress logging: progress.py
  • presets and local runs: presets.py

High-Level Workflow

flowchart TD
    A["BenchmarkSuiteConfig"] --> B["validate_forecasting_suite_config"]
    B --> C["Create run_id and progress monitor"]
    C --> D["For each DatasetSpec"]
    D --> E["build_dataset_adapter"]
    E --> F["load_series -> ForecastingSeriesRecord[]"]
    F --> G["For each ModelSpec"]
    G --> H["build_model_adapter"]
    H --> I["availability()"]
    I -->|"not available / skipped"| J["Emit BenchmarkRunRecord with status and metadata"]
    I -->|"available"| K["For each ForecastingSeriesRecord"]
    K --> L["analyze_regime_diagnostics(train)"]
    L --> M["recommend_forecasting_model(diagnostics)"]
    M --> N["model.forecast(series_record)"]
    N --> O["Validate horizon"]
    O --> P["compute_forecasting_metric for aggregate metrics"]
    P --> Q["compute_pointwise_metric for horizon-wise metrics"]
    Q --> R["append event-aware metrics if mask exists"]
    R --> S["Create PredictionRecord, MetricRecord, BenchmarkRunRecord"]
    J --> T["Continue model / dataset loop"]
    S --> T
    T --> U["build_leaderboard"]
    U --> V["ForecastingBenchmarkResult"]
Loading

Stage-by-Stage Breakdown

1. Config validation

run_forecasting_suite(...) starts by validating the benchmark configuration.

Responsibilities:

  • ensure task_type == forecasting
  • ensure datasets and models are present
  • ensure only supported metrics are requested

Why this matters:

  • keeps adapter/model failures separate from configuration failures
  • makes benchmark runs deterministic and reviewable

2. Runtime containers and progress monitor

The function initializes:

  • run_id
  • series_records
  • run_records
  • prediction_records
  • metric_records
  • BenchmarkProgressMonitor

This stage does not perform forecasting yet. It prepares the shell that will collect the benchmark state.

3. Dataset loop

For each DatasetSpec:

  1. build_dataset_adapter(dataset_spec) selects the appropriate adapter.
  2. dataset_adapter.load_series(dataset_spec) returns a tuple of ForecastingSeriesRecord.
  3. The progress monitor is updated with dataset-level counts.

Typical adapters:

  • M4Adapter
  • MonashAdapter
  • InMemoryForecastingAdapter

Each adapter is responsible for:

  • reading raw source data
  • producing clean train_values / test_values
  • preserving split provenance in metadata

4. Model loop

For each ModelSpec:

  1. build_model_adapter(model_spec) constructs the runtime adapter.
  2. model.availability() decides whether the model is executable in the current environment.

Two branches are possible:

  • RunStatus.SUCCESS: proceed to actual forecasting
  • RunStatus.SKIPPED / RunStatus.NOT_AVAILABLE: emit run records without forecasting

This separation is important for optional heavy models such as external deep baselines.

5. Series loop

For each ForecastingSeriesRecord:

  1. analyze_regime_diagnostics(train_values) computes structural diagnostics.
  2. recommend_forecasting_model(diagnostics) produces an explainable routing suggestion.
  3. model.forecast(series_record) produces forecast values and model metadata.
  4. The forecast horizon is validated against test_values.
  5. Aggregate and pointwise metrics are computed.
  6. Event-aware metrics are appended when the model returns a forcing mask.
  7. Prediction, metric, and run records are persisted in memory.

6. Result aggregation

After all dataset/model/series loops finish:

  • build_leaderboard(...) aggregates successful run records by benchmark, dataset, and model
  • the function returns ForecastingBenchmarkResult

run_forecasting_benchmark_suite(...) can then build publication artifacts and issue reports on top of this result bundle.

Core Runtime Objects

ForecastingSeriesRecord

Represents one benchmarked time series with a fixed train/test split.

Key fields:

  • benchmark
  • dataset_name
  • subset
  • series_id
  • frequency
  • forecast_horizon
  • seasonal_period
  • train_values
  • test_values
  • metadata

BenchmarkRunRecord

Represents one model run on one series.

Key fields:

  • status
  • metrics_summary
  • message
  • tags
  • metadata

Important metadata payloads currently present in forecasting runs:

  • regime_diagnostics
  • routing_recommendation
  • model-specific metadata such as:
    • OKHS diagnostics
    • HAVOK forcing mask
    • active/calm interval counts

MetricRecord

Stores either aggregate or horizon-wise metric values.

Distinguishing field:

  • horizon_index is None -> aggregate metric
  • horizon_index is not None -> per-horizon metric

PredictionRecord

Stores one forecast value per horizon step.

Diagnostics and Routing

analyze_regime_diagnostics(...)

This function converts a raw train series into a typed structural summary.

Computed signals:

  • series_length
  • dominant_period
  • acf_decay_rate
  • spectral_concentration
  • spectral_flatness
  • local_linearity_score
  • switching_score
  • regime_hint

Conceptually it answers:

  • is the series periodic?
  • does it look switching or bursty?
  • is it mostly locally linear?
  • is the structure weak or unstable?

recommend_forecasting_model(...)

This function takes the typed diagnostics and emits a typed routing recommendation.

Current primary routes:

  • periodic -> mssa or ssa_compat
  • switching / event-driven -> havok
  • locally linear -> okhs
  • insufficient or weak structure -> naive_last_value / linear_trend

Returned object:

  • RegimeRoutingDecision

Important fields:

  • primary_adapter
  • candidate_adapters
  • fallback_adapter
  • confidence
  • rationale

Why this is useful:

  • benchmark artifacts can explain what the system thinks the regime is
  • future orchestration can turn the same recommendation into actual model selection

Metrics and Records

The forecasting suite computes two categories of metrics.

Aggregate metrics

Produced by compute_forecasting_metric(...):

  • mae
  • rmse
  • smape
  • mase
  • owa

Horizon-wise metrics

Produced by compute_pointwise_metric(...) and stored with horizon_index.

Event-aware interval metrics

Produced by _append_event_interval_metrics(...) when forecast_forcing_mask is present.

Current outputs:

  • mae_active
  • mae_calm
  • active_forecast_steps
  • calm_forecast_steps

This makes HAVOK and future event-aware models benchmarkable without changing the global result schema.

Failure and Optional-Model Paths

Optional / unavailable models

If model.availability() reports a non-success status:

  • the suite still emits one BenchmarkRunRecord per series
  • the record includes:
    • optional
    • regime_diagnostics
    • routing_recommendation
  • no metrics or predictions are generated

Forecast execution errors

Two failure channels exist:

  • ModelExecutionError: expected benchmark/runtime failure with explicit status
  • generic Exception: unexpected failure, converted to RunStatus.FAILED

In both cases the suite preserves diagnostics metadata, which is important for post-mortem debugging.

Developer Hints

If you add a new dataset adapter

Make sure it returns valid ForecastingSeriesRecord objects and preserves split provenance in metadata.

If you add a new model adapter

The adapter should return:

  • forecast array with the correct horizon
  • typed or plain-JSON-compatible metadata
  • availability status for optional environments

If you add new diagnostics

Prefer adding them as typed records first, then serialize via .to_dict() into benchmark metadata.

If you add new routing rules

Keep three layers separate:

  • measurement: analyze_regime_diagnostics(...)
  • recommendation: recommend_forecasting_model(...)
  • execution: the actual selected model adapter

This separation is what keeps the system reviewable.

If you extend artifacts

Do not change the core result schema unless necessary. Prefer adding new metadata fields or publication-layer views.

Common Pitfalls

1. Confusing diagnostics with execution

routing_recommendation is currently advisory metadata, not a forced execution path.

2. Losing split provenance

Adapters must preserve how the train/test split was produced. Without this, benchmark comparisons become hard to trust.

3. Returning the wrong forecast shape

model.forecast(...) must match the target horizon exactly. Otherwise run_forecasting_suite(...) will emit a failed record.

4. Mixing aggregate and pointwise metrics

Keep aggregate leaderboard metrics separate from horizon-wise diagnostics.

5. Hiding optional dependency failures

Optional models should surface skipped / not_available explicitly instead of failing silently.

Recommended Contributor Reading Order

  1. benchmark/v2/core.py
  2. benchmark/v2/forecasting.py
  3. fedot_ind/core/models/ts_forecasting/regime_diagnostics.py
  4. fedot_ind/core/models/ts_forecasting/regime_routing.py
  5. benchmark/v2/analytics.py

Clone this wiki locally