blind
blind(scores, seed=0, label_prefix=_DEFAULT_PREFIX)
Relabel and shuffle the tools of a score table, returning a seal.
The tool axis is permuted under seed and renamed to opaque labels such as method_1, method_2, so neither the names nor the row order carry the methods’ identity. The metric and dataset axes are left unchanged, since the analyst needs them to set polarity, weights and the cross-dataset rule. The returned scores carry the seal fingerprint so a run on them records the blinding in its manifest.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
scores |
Scores | The score table or tensor to blind. | required |
seed |
int | Seed for the row permutation. The same seed reproduces the same blinding. | 0 |
label_prefix |
str | Prefix for the opaque labels. Default "method". |
_DEFAULT_PREFIX |
Returns
| Type | Description |
|---|---|
| tuple of (Scores, Seal) | The blinded scores and the seal that unblinds them. |
Examples
>>> import numpy as np
>>> from beam import Scores, blind, unblind
>>> s = Scores(
... values=np.array([[0.9, 0.1], [0.5, 0.5]]),
... tool_names=("seurat", "sc3"),
... metric_ids=("ari", "runtime"),
... dataset_names=None,
... layout="wide",
... )
>>> blinded, seal = blind(s, seed=1)
>>> set(blinded.tool_names) == {"method_1", "method_2"}
True
>>> set(seal.mapping.values()) == {"seurat", "sc3"}
True
>>> tuple(unblind(blinded, seal).tool_names) == tuple(seal.translate(blinded.tool_names))
True