|
| 1 | +.. _functional-causal-graphical-models: |
| 2 | + |
| 3 | +********************************** |
| 4 | +Functional Causal Graphical Models |
| 5 | +********************************** |
| 6 | + |
| 7 | +.. automodule:: pywhy_graphs.functional |
| 8 | + :no-members: |
| 9 | + :no-inherited-members: |
| 10 | + |
| 11 | +Pywhy-graphs provides a layer to convert imbue causal graphs with a data-generating |
| 12 | +model. Currently, we only support linear models, but we plan to support non-linear |
| 13 | +and we also do not support latent confounders yet. |
| 14 | + |
| 15 | +To add a latent confounder, one can add a confounder explicitly, generate the data |
| 16 | +and then drop the confounder varialble in the final dataset. In the roadmap of this submodule, |
| 17 | +the plan is to represent any bidirected edge as a uniformly randomly distributed variable |
| 18 | +that has an additive noise effect on both variables simulatanously. |
| 19 | + |
| 20 | +Linear |
| 21 | +====== |
| 22 | + |
| 23 | +In order to represent linear functions, we imbue nodes with a set of node attributes: |
| 24 | + |
| 25 | +- ``parent_functions``: a mapping of functions that map each node to a nested dictionary |
| 26 | + of parents and their corresponding weight and function that map parent values to |
| 27 | + values that are input to the node value with the weight. |
| 28 | +- ``gaussian_noise_function``: a dictionary with keys ``mean`` and ``std`` that |
| 29 | + encodes the data-generating function for the Gaussian noise. |
| 30 | + |
| 31 | + For example, if the node |
| 32 | + is :math:`X` and its parents are :math:`Y` and :math:`Z`, then ``parent_functions`` |
| 33 | + and ``gaussian_noise_function`` for node :math:`X` is: |
| 34 | + |
| 35 | + .. code-block:: python |
| 36 | +
|
| 37 | + { |
| 38 | + 'X': { |
| 39 | + 'parent_functions': { |
| 40 | + 'Y': { |
| 41 | + 'weight': <weight of Y added to X>, |
| 42 | + 'func': <function that takes input Y>, |
| 43 | + }, |
| 44 | + 'Z': { |
| 45 | + 'weight': <weight of Z added to X>, |
| 46 | + 'func': <function that takes input Z>, |
| 47 | + }, |
| 48 | + }, |
| 49 | + 'gaussian_noise_function': { |
| 50 | + 'mean': <mean of gaussian noise added to X>, |
| 51 | + 'std': <std of gaussian noise added to X>, |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | +
|
| 56 | +Linear functional graphs |
| 57 | +======================== |
| 58 | +.. currentmodule:: pywhy_graphs.functional |
| 59 | + |
| 60 | +.. autosummary:: |
| 61 | + :toctree: ../../generated/ |
| 62 | + |
| 63 | + make_graph_linear_gaussian |
| 64 | + apply_linear_soft_intervention |
| 65 | + |
| 66 | +Multidomain |
| 67 | +=========== |
| 68 | + |
| 69 | +Currently, this submodule only supports linear functions. |
| 70 | + |
| 71 | +Multiple-domain causal graphs are represented by selection diagrams :footcite:`bareinboim_causal_2016`, |
| 72 | +or augmented selection diagrams (TODO: CITATION FOR LEARNING SEL DIAGRAMS). |
| 73 | + |
| 74 | +In order to represent multidomain functions, we imbue nodes with a set of node attributes |
| 75 | +in addition to the ones for linear functions. The nodes that are imbued with extra attributes |
| 76 | +are the direct children of an S-node. |
| 77 | + |
| 78 | +- ``invariant_domains``: a list of domain IDs that are invariant for this node. |
| 79 | +- ``domain_gaussian_noise_function``: a dictionary with keys ``mean`` and ``std`` that |
| 80 | + encodes the data-generating function for the Gaussian noise for each non-invariant domain. |
| 81 | + |
| 82 | + .. code-block:: python |
| 83 | + |
| 84 | + { |
| 85 | + 'X': { |
| 86 | + 'domain_gaussian_noise_function': { |
| 87 | + <domain_id>: { |
| 88 | + 'mean': <mean of gaussian noise added to X>, |
| 89 | + 'std': <std of gaussian noise added to X>, |
| 90 | + }, |
| 91 | + 'invariant_domains': [<domain_id>, ...], |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | +
|
| 96 | +Linear functional selection diagrams |
| 97 | +==================================== |
| 98 | +.. currentmodule:: pywhy_graphs.functional |
| 99 | + |
| 100 | +.. autosummary:: |
| 101 | + :toctree: ../../generated/ |
| 102 | + |
| 103 | + make_graph_multidomain |
0 commit comments