Skip to content

Methods

Find methods and see what each one needs. Every call works offline.

Name Summary
mtb.find_methods Return the method ids that match every filter you pass.
mtb.method_info Return everything known about one method as a dict.
mtb.params_for Return the parameters of one method variant.

mtb.find_methods

find_methods(
    category: str | None = None,
    *,
    modalities: list[str] | set[str] | None = None,
    needs_labels: bool | None = None,
) -> list[str]

Return the method ids that match every filter you pass.

A method matches when one of its variants meets category, modalities and needs_labels together.

PARAMETERS DESCRIPTION
category

Integration category: vertical, diagonal, mosaic or cross; None = any.

type str | None default None

modalities

Modalities a variant must consume, e.g. ["rna", "adt"]; "atac_peak" / "atac_gas" also select by ATAC representation. None = no filter.

type list[str] | set[str] | None default None

needs_labels

True = a matching variant needs cell-type labels; False = one runs without them; None = no filter.

type bool | None default None

RETURNS DESCRIPTION
list[str]

Method ids in the package's order.

RAISES DESCRIPTION
ValueError

Unknown category or modality token.

TypeError

modalities is a bare string, not a list.

Examples

>>> import multibench as mtb
>>> mtb.find_methods("vertical", modalities=["rna", "adt"])
>>> mtb.find_methods("vertical", modalities=["rna", "adt"], needs_labels=False)
See Also

mtb.method_info : the per-variant supports table these filters are read from. mtb.scan : which of these methods can actually run on a given dataset.

mtb.method_info

method_info(method: str) -> dict

Return everything known about one method as a dict.

PARAMETERS DESCRIPTION
method

Method id, e.g. "Matilda"; see mtb.find_methods().

type str

RETURNS DESCRIPTION
dict

One flat record:

id, language, notes     the method id, 'python' or 'R', a summary
categories              the integration categories it runs in
env                     the conda env run executes it in
atac                    'peak' / 'gene_activity' / None
needs_labels            any variant reads cell-type labels
supports                one entry per variant: category, modalities,
                        output_kind, needs_labels, labels,
                        reference_batch
runtime                 measured_sec, tier, worst_sec, observed, host, note
gpu                     'required' / 'used when present' / 'not used' / 'unknown'
cpu_params              the flags that turn CUDA off on a CPU host
setup_hint              a step to take before the first run, or ''
repo_url                the upstream code the benchmark ran
reference               {doi, title, authors, journal, year}, or None
RAISES DESCRIPTION
KeyError

Unknown method id.

Examples

>>> import multibench as mtb
>>> info = mtb.method_info("Matilda")
>>> # one entry per variant: category, modalities, labels ...
>>> info["supports"]
See Also

mtb.params_for : the parameters of one variant, with upstream defaults. mtb.find_methods : filter methods by category, modalities, labels, ATAC representation.

mtb.params_for

params_for(
    method: str,
    category: str | None = None,
    modalities: list[str] | set[str] | None = None,
) -> dict

Return the parameters of one method variant.

Call it before run(params=...) to see what a method accepts and what it runs with when you pass nothing.

PARAMETERS DESCRIPTION
method

Method id, e.g. "Matilda"; see mtb.find_methods().

type str

category

Integration category of the variant: vertical, diagonal, mosaic or cross; None = infer it from the other arguments.

type str | None default None

modalities

Modality tokens of the variant, e.g. ["rna", "adt"]; None = infer it from the other arguments.

type list[str] | set[str] | None default None

RETURNS DESCRIPTION
dict

method, variant ('category:mods', or several that take the same parameters), tunable (what params= can set, {name: {"type", "default"}}; default is what a run uses when you pass nothing, and None leaves it to the method's library), fixed_in_script (what the script pins, with file:line), upstream_knobs (what its library documents but the script does not expose) and upstream_url.

RAISES DESCRIPTION
KeyError

Unknown method, or no variant for category / modalities.

ValueError

Unknown category or modality token, or several variants with other parameters fit (the message spells out the call that selects one).

Examples

>>> import multibench as mtb
>>> p = mtb.params_for("Matilda", "vertical", ["rna", "adt"])
>>> p["tunable"]["epochs"]["default"]
30
See Also

mtb.run : takes these keys as params={method: {key: value}}.