cascade.model.CASCADE.design

CASCADE.design(source, target, pool=None, init=None, design_size=1, design_scale_bias=False, target_weight=None, stratify=None, opt='AdamW', lr=5e-2, weight_decay=0.01, accumulate_grad_batches=1, batch_size=32, val_check_interval=300, val_frac=0.1, max_epochs=1000, n_devices=1, log_subdir='design', verbose=False, **kwargs)[source]

Targeted intervention design with continuous optimization

Parameters:
  • source (AnnData) – Source dataset

  • target (AnnData) – Target dataset representing desired outcome

  • pool (list[str] | None) – Optional list of variables as candidate pool

  • init (list[str] | None) – Optional list of variables to initialize the designed interventions

  • design_size (int) – Maximal combinatorial order to consider

  • design_scale_bias (bool) – Whether to optimize the intervention scale and bias

  • target_weight (str | None) – Optional column name in target.var to weight target variables when computing target deviation

  • stratify (str | None) – Column name in obs for stratified random pairing

  • opt (str) – Optimizer

  • lr (float) – Learning rate

  • weight_decay (float) – Weight decay

  • accumulate_grad_batches (int) – Number of batches to accumulate before optimizer step

  • batch_size (int) – Batch size

  • val_check_interval (int) – Validation check interval

  • val_frac (float) – Validation fraction

  • max_epochs (int) – Maximum number of epochs

  • n_devices (int) – Number of GPU devices to use

  • log_subdir (PathLike) – Tensorboard log subdirectory (under model-wise log_dir)

  • verbose (bool) – Whether to print verbose logs

  • **kwargs – Additional keyword arguments are passed to Trainer

Return type:

tuple[DataFrame, IntervDesign]

Returns:

  • DataFrame of design scores containing the following column

    • “score”: Design score

    Indexed by intervention and sorted by descending scores

  • Intervention design module