summaryrefslogtreecommitdiff
path: root/experiments/bci_v2_calibrated_smoke.py
blob: 1c057831471fc9967c3a0276b602df06d01350c1 (plain)
1
2
3
4
5
6
7
8
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
34
35
36
#!/usr/bin/env python3
"""Endpoint-free checks for calibration-split target selection."""
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from experiments.bci_v2_calibrated_run import (
    CALIBRATION_EPISODES,
    TARGET_QUANTILES,
    calibrate_targets,
)
from experiments.bci_v2_recovery_run import build_recovery_config
from sdil.bci_v2 import BCIV2


def check_calibration_without_outcomes():
    cfg = build_recovery_config()
    model = BCIV2(cfg, model_seed=901)
    targets, report = calibrate_targets(
        model, task_seed=902, seed_offset=900_000
    )
    assert report["episodes"] == CALIBRATION_EPISODES
    assert report["quantiles"] == list(TARGET_QUANTILES)
    assert report["uses_outcome_labels"] is False
    assert len(targets) == len(TARGET_QUANTILES)
    assert all(
        targets[index] < targets[index + 1]
        for index in range(len(targets) - 1)
    )
    assert all(-2.0 < target < 2.0 for target in targets)
    print("calibration targets use only independent cursor quantiles: exact")


if __name__ == "__main__":
    check_calibration_without_outcomes()
    print("ALL CALIBRATION-SPLIT MECHANICS CHECKS PASSED")