cascade.model.CASCADE
- class cascade.model.CASCADE(vars, n_particles=4, n_covariates=0, n_layers=1, hidden_dim=16, latent_dim=16, dropout=0.2, beta=0.1, scaffold_mod='Edgewise', sparse_mod='L1', acyc_mod='SpecNorm', latent_mod='EmbLatent', lik_mod='NegBin', kernel_mod='RBF', scaffold_graph=None, latent_data=None, scaffold_kws=None, sparse_kws=None, acyc_kws=None, latent_kws=None, lik_kws=None, kernel_kws=None, random_state=0, log_dir='.', _net=None)[source]
Bases:
objectCausality-Aware Single-Cell Adaptive Discover/Deduction/Design Engine
- Parameters:
n_particles (
int) – Number of SVGD particlesn_covariates (
int) – Dimension of covariatesn_layers (
int) – Number of MLP layers in the structural equationshidden_dim (
int) – MLP hidden layer dimension in the structural equationslatent_dim (
int) – Dimension of the latent variable (see notes below on how to specifylatent_datadepending onlatent_mod)dropout (
float) – Dropout ratebeta (
float) – KL weight of the latent variablescaffold_mod (
str) – Scaffold graph module, must be one of {“Edgewise”, “Bilinear”}sparse_mod (
str) – Sparse prior module, must be one of {“L1”, “ScaleFree”}acyc_mod (
str) – Acyclic prior module, must be one of {“TrExp”, “SpecNorm”, “LogDet”}latent_mod (
str) – Latent module, must be one of {“NilLatent”, “EmbLatent”, “GCNLatent”}lik_mod (
str) – Causal likelihood module, must be one of {“Normal”, “NegBin”}kernel_mod (
str) – SVGD kernel module, must be one of {“KroneckerDelta”, “RBF”}scaffold_graph (
TypeVar(SimpleGraph,Graph,DiGraph) |None) – Optional scaffold graphlatent_data (
DataFrame|TypeVar(SimpleGraph,Graph,DiGraph) |None) – Optional latent data (see notes below on how to specifylatent_datadepending onlatent_mod)scaffold_kws (
Mapping[str,Any] |None) – Keyword arguments to the scaffold graph module, seeEdgewiseorBilinearfor detailssparse_kws (
Mapping[str,Any] |None) – Keyword arguments to the sparse prior module, seeL1orScaleFreefor detailsacyc_kws (
Mapping[str,Any] |None) – Keyword arguments to the acyclic prior module, seeTrExp,SpecNorm, orLogDetfor detailslatent_kws (
Mapping[str,Any] |None) – Keyword arguments to the latent module, seeNilLatent,EmbLatent, orGCNLatentfor detailslik_kws (
Mapping[str,Any] |None) – Keyword arguments to the causal likelihood module, seeNormalorNegBinfor detailskernel_kws (
Mapping[str,Any] |None) – Keyword arguments to the SVGD kernel module, seeKroneckerDeltaorRBFfor detailsrandom_state (
RandomState|int|None) – Random statelog_dir (
PathLike) – Directory to store tensorboard logs_net (
CausalNetwork|None) – Internal use ONLY
Note
The setting for
latent_dimandlatent_datafollows rules below:When
latent_mod="NilLatent",latent_datamust beNone. The latent variable is always the standard normal distribution with dimension oflatent_dim.When
latent_mod="EmbLatent",latent_datamust be aDataFrame, where the index is the variable names and the columns are the embedding dimensions.latent_dimbut must be larger than 0, but does not need to equal the dimension oflatent_data, as the latent variable is encoded from the provided embedding with a linear transformation.When
latent_mod="GCNLatent",latent_datamust be aGraphorDiGraph, where the nodes are the variable names and the edges are latent connections.latent_dimmust be larger than 0. The latent variable is encoded from the provided graph with a graph convolutional network.
Methods
Counterfactual deduction for the outcome of alternative interventions for an observed dataset
Targeted intervention design with continuous optimization
Intervention design with brute-force exhaustion
Fit an error curve against design scores
Model diagnosis
Causal discovery
Explain counterfactual outcome with individual components
Export learned causal graph
Export the reshaped causal map indicating which input gene is in each reshaped position for each output gene, useful for interpreting the result of
explain().Import pruned causal graph
Compute the Jacobian matrix of the model
Load model from file
Save model to file
Fine-tune structural equations with fixed causal structure