Exposed public API for RSL-D
Recursive Skeleton Learning for diamond-free graphs (RSL-D).
Implements the diamond-free branch of the Recursive Skeleton Learning algorithms introduced in our JMLR paper “Recursive Causal Discovery.” All references to propositions or lemmas align with that paper’s numbering.
learn_and_get_skeleton(ci_test, data, find_markov_boundary_matrix_fun=None)
Learn a skeleton for a diamond-free graph using RSL-D.
Parameters
ci_test : Callable[[int, int, list[int], np.ndarray], bool]
Conditional independence test that accepts the indices of two variables,
a conditioning set, and the full data matrix.
data : ndarray or pandas.DataFrame
Observational dataset shaped (n_samples, n_vars).
find_markov_boundary_matrix_fun : Callable[[np.ndarray], np.ndarray], optional
Optional custom routine for estimating the Markov boundary matrix. When
omitted, the default Gaussian estimator is used.
Returns
nx.Graph Learned undirected skeleton.
Source code in rcd/rsl/rsl_d.py
RSL-D implementation details
Bases: _RSLBase
Specialization of :class:_RSLBase for diamond-free graphs.
Source code in rcd/rsl/rsl_d.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
__init__(ci_test, find_markov_boundary_matrix_fun=None)
Configure the diamond-free learner.
Parameters
ci_test : Callable[[int, int, list[int], np.ndarray], bool]
Conditional independence oracle supplied by the caller.
find_markov_boundary_matrix_fun : Callable[[np.ndarray], np.ndarray], optional
Alternative Markov-boundary estimator. Falls back to the Gaussian
estimator when None.
Source code in rcd/rsl/rsl_d.py
find_neighborhood(var)
Return the neighborhood of var via Proposition 40.
Parameters
var : int Variable whose neighbors should be retrieved.
Returns
np.ndarray
Indices of the neighbors of var.
Source code in rcd/rsl/rsl_d.py
is_removable(var)
Check whether var is removable via Theorem 39.
Parameters
var : int Variable to check for removability.
Returns
bool
True when the variable can be safely removed.