Skip to main content

Research studio for BER equalization experiments in nonlinear optical links.

Project description

BER Equalization Studio

Research library for BER equalization experiments in nonlinear fiber-optic links.

The studio wraps the existing, validated BER_minimization_survey/ber_equalization.py backend with a cleaner API:

  • structured dataclass configs instead of editing one large global Config;
  • model registry and aliases;
  • reusable experiment runner;
  • per-model run folders with checkpoints, metrics, histories, and plots;
  • result comparison helpers for paper tables;
  • Plotly HTML visualizations for BER/loss curves and model tradeoffs.

Layout

ber-equalization-studio/
  src/ber_equalization_studio/
    config.py          # DataConfig, ModelConfig, TrainingConfig, StudioConfig
    legacy.py          # adapter to the original ber_equalization.py backend
    models.py          # model registry and constructors
    data.py            # dataset preparation wrapper
    experiment.py      # ExperimentRunner
    api.py             # notebook-friendly Studio, RunResult, StudyResult
    results.py         # result loading/comparison helpers
    visualization.py   # BER/loss/complexity plots
    cli.py             # ber-studio command
  examples/
    run_smoke.py

Quick Start

Install from PyPI:

python -m pip install "ber-equalization-studio[notebook]"

For local development from the repository root:

cd ber-equalization-studio
python -m pip install -e ".[notebook,dev]"
ber-studio models

Run a short smoke experiment:

ber-studio run `
  --name smoke_complex_fastkan `
  --models complex_fastkan,mlp `
  --data-dir ..\BER_minimization_survey\symbols_new `
  --epochs 5 `
  --max-test-files 1

If your symbol CSV files live directly under BER_minimization_survey, pass that folder instead. The backend searches for files named:

Symbols_1m_1ch_PR_*.csv

The PyPI package includes the legacy training backend and the local EfficientKAN implementation used by the studio. You only need to pass data directories with symbol CSV files.

Notebook API

The easiest way to work from Jupyter is the high-level Studio interface:

from ber_equalization_studio import Studio

studio = Studio(
    data_dirs=["../test"],
    out_dir="notebook_runs",
    device="cuda",
)

studio.models()

Run one experiment:

run = studio.run(
    name="fastkan_smoke",
    models=["complex_fastkan", "mlp"],
    epochs=5,
    lr=1e-3,
    context_k=32,
    max_test_files=1,
)

run.results

Useful result helpers:

run.best()
run.compare()
run.history("complex_fastkan")
run.plot_history("complex_fastkan")
run.plot_comparison()
run.run_dir

Sweep a small research grid:

study = studio.sweep(
    name="context_lr_sweep",
    models=["complex_fastkan"],
    grid={
        "context_k": [16, 32, 64],
        "lr": [1e-3, 3e-4],
    },
    epochs=50,
    max_test_files=2,
)

study.results.sort_values("equalized_ber")
study.best()
study.plot_tradeoff(x="trainable_params", y="equalized_ber")

Short parameters such as epochs, lr, context_k, max_test_files, data_dirs, and out_dir are mapped to the structured config. For advanced settings, use dotted keys:

run = studio.run(
    name="custom_eval",
    models="complex_fastkan",
    **{
        "evaluation.ber_scale_steps": 20,
        "training.early_stopping_patience": 100,
    },
)

Low-Level Python API

from pathlib import Path

from ber_equalization_studio import (
    DataConfig,
    ExperimentConfig,
    ExperimentRunner,
    OutputConfig,
    StudioConfig,
    TrainingConfig,
)

config = StudioConfig(
    data=DataConfig(
        data_dirs=[Path("../BER_minimization_survey/symbols_new")],
        context_k=32,
        max_test_files=1,
    ),
    training=TrainingConfig(epochs=10, learning_rate=1e-3),
    output=OutputConfig(out_dir=Path("studio_outputs"), experiment_name="fastkan_baseline"),
    experiment=ExperimentConfig(models=["complex_fastkan", "efficient_kan_baseline", "mlp"]),
)

result = ExperimentRunner(config).run()
print(result["results_csv"])

Available Models

Use:

ber-studio models

Important current models:

  • complex_fastkan: lightweight complex temporal encoder + RBF/FastKAN regression head.
  • complex_fastkan_classifier: same encoder + RBF/FastKAN 16-class detector.
  • efficient_kan_baseline: flat IQ window + B-spline EfficientKAN regression.
  • kan_classifier: flat IQ window + B-spline EfficientKAN classifier.
  • cnn_kan: temporal CNN + EfficientKAN head.
  • mlp, cnn, tcn, lstm, transformer: neural baselines.

Outputs

Each run creates:

studio_outputs/<experiment_name>/
  config.json
  dataset_summary.json
  results.csv
  model_comparison_ber.html
  model_comparison_complexity.html
  <model_name>/
    metrics.json
    history.json
    final_state_dict.pt
    <model_name>_loss.html
    <model_name>_ber.html

Compare previous runs:

ber-studio compare studio_outputs

Research Workflow

Recommended progression:

  1. In Jupyter, start with Studio(...).models() to choose candidate models.
  2. Run complex_fastkan, efficient_kan_baseline, and mlp as a short smoke test.
  3. Increase epochs and use the full test split for promising candidates.
  4. Use run.results, study.results, and saved results.csv files for paper tables.
  5. Sweep one family at a time with studio.sweep(...), changing only a few parameters per study.

The current implementation intentionally keeps the original backend intact. That means existing BER computation, Gray labels, file-level split protocol, normalization, KAN implementations, and training loop behavior are preserved while the new API makes future experiments much easier to compose.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ber_equalization_studio-0.1.0.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ber_equalization_studio-0.1.0-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

File details

Details for the file ber_equalization_studio-0.1.0.tar.gz.

File metadata

  • Download URL: ber_equalization_studio-0.1.0.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for ber_equalization_studio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c827eb84211c2c934deb16720fff6ed7f3879646142595748a3034767a8ebb95
MD5 5c9562700ba361013ca0a6cdfd97e6b4
BLAKE2b-256 ba13ce80be4c223bf9ca2c58a9e6d4d7b7384d5c8b14391d0c9bcd9dff98f1ae

See more details on using hashes here.

File details

Details for the file ber_equalization_studio-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ber_equalization_studio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b3b12223a5909afb7e13a181a8ee1aa09349048e5311b6deb5e1ec2e9ce8f55
MD5 89662adbd1789aa18738ec43cec3f4be
BLAKE2b-256 a81f60a7d4f7dec0094998da1b36a52fb3d31f6fa321f9c8b5d3c95a35c62856

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page