iscan.shifted_nodes.est_node_shifts
¶
-
iscan.shifted_nodes.est_node_shifts(X: numpy.ndarray | torch.Tensor, Y: numpy.ndarray | torch.Tensor, eta_G: float =
0.001
, eta_H: float =0.001
, normalize_var: bool =False
, shifted_node_thres: float =2.0
, elbow: bool =False
, elbow_thres: float =30.0
, elbow_online: bool =True
, use_both_rank: bool =True
, verbose: bool =False
) tuple[list, list, dict] ¶ - Implementation of the iSCAN method of Chen et al. (2023).Returns an estimated topological ordering, and estimated shifted nodes
References
Chen, K. Bello, B. Aragam, P. Ravikumar. (2023). iSCAN: Identifying Causal Mechanism Shifts among Nonlinear Additive Noise Models.
- Parameters:¶
- X : Union[np.ndarray, torch.Tensor]¶
Dataset with shape \((n,d)\), where \(n\) is the number of samples, and \(d\) is the number of variables/nodes.
- Y : Union[np.ndarray, torch.Tensor]¶
Dataset with shape \((n,d)\), where \(n\) is the number of samples, and \(d\) is the number of variables/nodes.
- eta_G : float, optional¶
hyperparameter for the score’s Jacobian estimation, by default 0.001.
- eta_H : float, optional¶
hyperparameter for the score’s Jacobian estimation, by default 0.001.
- normalize_var : bool, optional¶
If
True
, the Hessian’s diagonal is normalized by the expected value, by defaultFalse
.- shifted_node_thres : float, optional¶
Threshold to decide whether or not a variable has a distribution shift, by default 2.
- elbow : bool, optional¶
If
True
, iscan uses the elbow heuristic to determine shifted nodes. By defaultTrue
.- elbow_thres : float, optional¶
If using the elbow method,
elbow_thres
is thehard_thres
infind_elbow()
function, by default 30.- elbow_online : bool, optional¶
If using the elbow method,
elbow_online
isonline
infind_elbow()
function, by defaultTrue
.- use_both_rank : bool, optional¶
estimate topo order by X’s and Y’s rank sum. If False, only use X for topo order, by default
False
.- verbose : bool, optional¶
If
True
, prints to stdout the variances of the Hessian entries for the running leafs. By defaultFalse
.
- Returns:¶
estimated shifted nodes, topological order, and dict of variance ratios for all nodes.
- Return type:¶