AxoBench API

Intervention inputs

Signatures, parameters, return values, and source for intervention inputs.

Overview

Input-side constructors for the five intervention conditions and a loader for paired intervention shards. Each constructor returns the edited inputs and a boolean mask of the baseline events it removed or moved. Producing teacher targets for new inputs requires the simulator stack in axobench.generation. Paired interventions describes the released conditions.

Source revision: 496e0c1a2dfd. Export index.

make_structured_intervention_inputs

axobench.benchmark.structured_intervention.make_structured_intervention_inputs(inputs: np.ndarray, *, intervention: str, seed: int=0, dropout_probability: float=0.35, jitter_steps: int=2, site_start_fraction: float=0.0, site_fraction: float=0.25) -> tuple[np.ndarray, np.ndarray, dict[str, Any]]

Source

Apply one named condition with the released v1 parameters as defaults. Exported from axobench.benchmark.

Parameters

inputs np.ndarray
required. Signed inputs, (trace, time, channels) or (time, channels).
intervention str
keyword-only, required. event_dropout, exc_dropout, inh_dropout, temporal_jitter, or site_silence.
seed int
keyword-only, default=0. Seed of the random conditions.
dropout_probability float
keyword-only, default=0.35. Removal probability of the dropout conditions.
jitter_steps int
keyword-only, default=2. Maximum absolute shift of temporal_jitter.
site_start_fraction float
keyword-only, default=0.0. Start of the silenced band as a fraction of the sites per sign.
site_fraction float
keyword-only, default=0.25. Width of the silenced band as a fraction of the sites per sign.

Returns

intervened np.ndarray
Edited inputs.
changed np.ndarray
Boolean mask of edited baseline events.
metadata dict[str, Any]
Condition parameters and baseline, intervention, and changed event counts.

make_event_dropout_inputs

axobench.benchmark.structured_intervention.make_event_dropout_inputs(inputs: np.ndarray, *, dropout_probability: float, seed: int=0) -> tuple[np.ndarray, np.ndarray]

Source

Remove each nonzero event independently with the given probability. Exported from axobench.benchmark.

Parameters

inputs np.ndarray
required. Signed inputs.
dropout_probability float
keyword-only, required. Removal probability in [0, 1].
seed int
keyword-only, default=0. Random seed.

Returns

intervened np.ndarray
Edited inputs.
changed np.ndarray
Mask of removed events.

make_selective_event_dropout_inputs

axobench.benchmark.structured_intervention.make_selective_event_dropout_inputs(inputs: np.ndarray, *, dropout_probability: float, event_sign: int, seed: int=0) -> tuple[np.ndarray, np.ndarray]

Source

Remove only excitatory (+1) or only inhibitory (-1) events with the given probability. Exported from axobench.benchmark.

Parameters

inputs np.ndarray
required. Signed inputs.
dropout_probability float
keyword-only, required. Removal probability in [0, 1].
event_sign int
keyword-only, required. 1 for excitatory or -1 for inhibitory events.
seed int
keyword-only, default=0. Random seed.

Returns

intervened np.ndarray
Edited inputs.
changed np.ndarray
Mask of removed events.

make_temporal_jitter_inputs

axobench.benchmark.structured_intervention.make_temporal_jitter_inputs(inputs: np.ndarray, *, max_jitter_steps: int, seed: int=0) -> tuple[np.ndarray, np.ndarray]

Source

Move every event by an integer shift drawn uniformly from -max_jitter_steps to +max_jitter_steps, clipped to the trace. Events that land on the same step and channel merge. Exported from axobench.benchmark.

Parameters

inputs np.ndarray
required. Signed inputs.
max_jitter_steps int
keyword-only, required. Maximum absolute shift; 0 returns a copy.
seed int
keyword-only, default=0. Random seed.

Returns

intervened np.ndarray
Edited inputs, (trace, time, channels).
changed np.ndarray
Mask of baseline events that moved.

make_site_silence_inputs

axobench.benchmark.structured_intervention.make_site_silence_inputs(inputs: np.ndarray, *, start_fraction: float=0.0, site_fraction: float=0.25) -> tuple[np.ndarray, np.ndarray]

Source

Remove all events on a contiguous band of sites in both the excitatory and the inhibitory half of the channels. The band is a channel range; on a morphology that leaves some sites without a synapse it silences fewer effective synapses. Exported from axobench.benchmark.

Parameters

inputs np.ndarray
required. Signed inputs with excitatory and inhibitory halves.
start_fraction float
keyword-only, default=0.0. Start of the band as a fraction of the sites per sign.
site_fraction float
keyword-only, default=0.25. Width of the band as a fraction of the sites per sign; at least one site.

Returns

intervened np.ndarray
Edited inputs.
changed np.ndarray
Mask of removed events.

load_intervention_pair_npz

axobench.benchmark.runner.load_intervention_pair_npz(path: str | Path, *, max_samples: int | None=None) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, list[str]]

Source

Load the first pairs of a paired intervention shard. The file is opened with allow_pickle=True, so load only trusted files. Exported from axobench.benchmark.

Parameters

path str | Path
required. Pair shard.
max_samples int | None
keyword-only, default=None. Maximum pairs; None loads all.

Returns

arrays tuple
baseline_inputs, baseline_targets, intervention_inputs, intervention_targets, and the sample IDs.

Search guides, examples, and API signatures.