Skip to content

Kernel Learning Benchmark Runbook

v1docq edited this page Jul 14, 2026 · 1 revision

Kernel Learning: запуск бенчмарков

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


Источник: docs/dev_guide/kernel_learning_benchmark_runbook.md

Kernel Learning Benchmark Runbook

Scope

This runbook covers the MVP kernel-learning benchmark flow for supervised UCR time-series classification and the two-stage warm-start experiment.

For the general benchmark development contract, typed config rules, result storage layout, and showcase-table policy, see docs/dev_guide/benchmark_infrastructure.md. This runbook only documents the Kernel Learning-specific execution flow.

The public estimator API remains:

from fedot_ind.core.kernel_learning import KernelEnsembleClassifier, KernelEnsembleRegressor

Experiment orchestration helpers live in the benchmark layer, because they load datasets, render benchmark artifacts, and intentionally depend on benchmark.industrial:

from benchmark.industrial.experiments.kernel_learning import (
    KernelLearningStage1Runner,
    KernelLearningStage2Runner,
)

The lightweight estimator API in fedot_ind.core.kernel_learning no longer imports benchmark orchestration helpers.

Runner Configuration Contract

Kernel-learning benchmark scripts are thin shell entrypoints. The typed experiment builders live in:

from benchmark.experiments.kernel_learning.configs import (
    KernelLearningM4ExperimentConfig,
    KernelLearningTSERExperimentConfig,
    KernelLearningTwoStageUCRExperimentConfig,
    KernelLearningUCRExperimentConfig,
)

The model lists, generator sets, metrics, output templates, and run defaults live in:

benchmark/experiments/kernel_learning/defaults.json

For suite-style experiments, the canonical execution path is:

typed_config.build_suite_config() -> run_registered_suite(...)

This writes the regular benchmark artifacts plus the resolved config, run summary, registry entry, and registry index. Environment variables and CLI arguments should be normalized into one of the typed config records before the run starts.

Stage 1: Kernel Learning On UCR

Use the UCR script when you want to train the kernel ensemble and persist kernel diagnostics after each dataset/model run.

python benchmark/experiments/kernel_learning/classification/run_ucr.py

Important defaults:

  • UCR_DATA_ROOT = PROJECT_ROOT / "data";
  • UCR_DATASETS = () means all locally discovered datasets from the configured UCR benchmark allow-list;
  • missing explicitly requested datasets are downloaded through the existing repository UCR loader when download_if_missing=True;
  • topology is excluded from the default MVP generator set.

The UCR script now compares four kernel-learning variants:

  • KernelEnsembleClassifier_score_baseline_summary: score-based selector baseline on summary features;
  • KernelEnsembleClassifier_adaptive_all_non_topological: projected-gradient sparse MKL over the non-topological generator set;
  • KernelEnsembleClassifier_shapelet_motif_rbf: shapelet/local-pattern features plus statistical summary features;
  • KernelEnsembleClassifier_embedding_nystrom: embedding-style features with opt-in Nystrom kernel approximation.

Expected artifacts:

benchmark/results/kernel_learning/<run_id>/
  runs/<dataset>/<model>/
    run.json
    metrics.json
    predictions.csv
    kernel_diagnostics.json
    kernel_selection.json
  records/
    runs.jsonl
    metrics.jsonl
    predictions.jsonl
    kernel_diagnostics.jsonl

The per-run JSON artifacts are written incrementally, so completed datasets remain available even if a later dataset fails.

Stage 2: Warm-Start FEDOT Evolution

The two-stage script can either run stage 1 or load an existing stage 1 run.

Load an existing stage 1 run and execute stage 2:

python benchmark/experiments/kernel_learning/classification/run_ucr_two_stage.py `
  --stage1-run-id kernel_learning_ucr_stage1_ba419d49e4

Run stage 1 first, then stage 2:

python benchmark/experiments/kernel_learning/classification/run_ucr_two_stage.py --run-stage-1

Run stage 1 for selected datasets:

python benchmark/experiments/kernel_learning/classification/run_ucr_two_stage.py `
  --run-stage-1 `
  --datasets Coffee Lightning7

Load or run stage 1 only:

python benchmark/experiments/kernel_learning/classification/run_ucr_two_stage.py --skip-stage-2

Useful stage 2 controls:

python benchmark/experiments/kernel_learning/classification/run_ucr_two_stage.py `
  --stage2-output-dir benchmark/results/kernel_learning/ucr_two_stage_optim_debug `
  --timeout-minutes 5 `
  --pop-size 5

Stage 2 writes one directory per dataset:

benchmark/results/kernel_learning/ucr_two_stage_optim_<date>/
  <dataset>/
    initial_population_specs.json
    fedot_config.json
    metrics.json
    predictions.csv
    optimizer_summary.json
  stage2_summary.json

Runtime initial assumptions are passed to FedotIndustrial as lazy PipelineBuilder objects. They are built after the industrial operation repository is activated, so operations such as wavelet_basis resolve as data operations rather than models.

TSER Regression Suite

Use the TSER script to validate the regression path and compare score-based selection against adaptive MKL:

python benchmark/experiments/kernel_learning/regression/run_tser.py

The TSER script compares:

  • KernelEnsembleRegressor_score_linear_summary;
  • KernelEnsembleRegressor_adaptive_rbf_summary;
  • KernelEnsembleRegressor_shapelet_rbf;
  • KernelEnsembleRegressor_embedding_nystrom.

Expected artifacts follow the same benchmark/results/kernel_learning/<run_id>/ layout and include kernel_selection plus kernel_diagnostics for each successful model run.

Forecasting Suite

Use the forecasting script to validate the public KernelEnsembleForecaster through the Industrial forecasting adapter:

python benchmark/experiments/kernel_learning/forecasting/run_m4.py

The forecasting script uses local M4 CSV files and a small sample size by default. It compares:

  • NaiveLastValue;
  • LaggedRidgeForecaster;
  • KernelEnsembleForecaster_identity_shapelet;
  • KernelEnsembleForecaster_embedding_nystrom_okhs.

The kernel forecasting adapter turns each train series into supervised lag windows, fits KernelEnsembleForecaster, and stores kernel-learning artifacts in the run metadata.

Stage 1 Analysis

Use the analyzer script to summarize saved kernel diagnostics and selected generators:

python benchmark/experiments/kernel_learning/analysis/analyze_stage1.py `
  --run-dir benchmark/results/kernel_learning/ucr_two_stage_140526/kernel_learning_ucr_stage1_ba419d49e4

The summary report and visualizations are useful for selecting datasets for stage 2 and for reviewing which feature generators were most informative.

Targeted Test Command

In the current Windows environment, pytest may try to autoload unavailable third-party plugins. Disable plugin autoload for targeted kernel-learning checks:

$env:PYTEST_DISABLE_PLUGIN_AUTOLOAD='1'
& "D:\data_old\WORK\Repo\Industiral\IndustrialTS\venv_3.9_new\Scripts\python.exe" -m pytest -q `
  tests\unit\core\kernel_learning `
  tests\unit\api\utils\test_kernel_warm_start_strategy.py `
  tests\unit\models\test_benchmark_*kernel_learning.py `
  tests\unit\models\test_benchmark_*incremental_artifacts.py `
  tests\unit\models\test_kernel_learning_experiment_scripts.py `
  tests\unit\models\test_kernel_learning_stage1_analysis.py

Pre-Merge Checklist

  • Targeted kernel-learning pytest passes.
  • python -m py_compile passes for benchmark scripts and fedot_ind/core/kernel_learning.
  • Stage 1 artifacts can be loaded with RUN_STAGE_1=False.
  • Stage 2 initial assumptions are lazy PipelineBuilder objects.
  • wavelet_basis, fourier_basis, and eigen_basis resolve as data operations after industrial repository initialization.
  • No topology generator is included in default MVP benchmark presets.

Clone this wiki locally