← Python API
vraven · function

run_perturbation_stability

run_perturbation_stability(model: 'nn.Module', inputs: 'Any', *, target: 'int | None' = None, levels: 'list[float] | None' = None, kinds: 'tuple[PerturbKind, ...]' = ('noise', 'feature_mask', 'shuffle'), repeats: 'int' = 5, random_seed: 'int' = 17, auto_move_inputs: 'bool' = True) -> 'PerturbationResult'

Estimate score stability under increasing perturbation strength.

Stability at each level is the mean cosine similarity between the vector
``[baseline_score]`` and per-repeat perturbed scores after normalising by
the baseline magnitude, clipped to ``[0, 1]`` as a practical stability index:
``1 - |score' - score| / (|score| + eps)``.

Usage

from vraven import run_perturbation_stability

result = run_perturbation_stability(... )
Source of truthThis page is generated from the checked-out public symbol, signature, and docstring. Pin the package version for reproducible work.