Skip to content

print

Signature/Parameters

def print(self, what = 'graph', identification = dict(content='default', style='text', strategy='all', parameter='ACE', omit_DAG=True, print_assumptions=None, print_assumptions_verbose=None))

Display graph or identification information using configured options.

Parameters:

Name Type Description Default
what (graph, DAG, dag, identification)

Content selector. Case-insensitive variants for graph display are accepted. Defaults to 'graph'.

'graph'
identification dict

Print configuration dict forwarded to the internal identification object. Missing keys fall back to global defaults obtained from get_options().

dict(content='default', style='text', strategy='all', parameter='ACE', omit_DAG=True, print_assumptions=None, print_assumptions_verbose=None)

Returns:

Type Description
None

Examples:

>>> G = DAG(graph="X -> Y")
>>> G.print(what="graph")
>>> G.identification_analysis(exposure="X", outcome="Y", verbose=False)
>>> G.print(what="identification", identification={"content": "strategy"})
Source code in causalinf/gcm.py
def print(self,
          what = 'graph',
          identification = dict(
              content='default',
              style='text',
              strategy = 'all',
              parameter = 'ACE',
              omit_DAG=True,
              print_assumptions=None,
              print_assumptions_verbose=None
          )
          ):
    """
    Display graph or identification information using configured options.

    Parameters
    ----------
    what : {'graph', 'DAG', 'dag', 'identification'}, optional
        Content selector. Case-insensitive variants for graph display are
        accepted. Defaults to ``'graph'``.
    identification : dict, optional
        Print configuration dict forwarded to the internal identification
        object. Missing keys fall back to global defaults obtained from
        ``get_options()``.

    Returns
    -------
    None

    Examples
    --------
    >>> G = DAG(graph="X -> Y")
    >>> G.print(what="graph")
    >>> G.identification_analysis(exposure="X", outcome="Y", verbose=False)
    >>> G.print(what="identification", identification={"content": "strategy"})
    """
    if what in ['graph', 'DAG', 'dag']:
        print(self)
    if what=='identification':
        ops = identification.copy()
        # defaults
        pars = ["print_assumptions", "print_assumptions_verbose"]
        for par in pars:
            if ops.get(par, None) is None:
                ops[par] = get_options()[par]

        if not self.__identification__:
            self.identification_analysis()
        self.__identification__.print(**identification)
        self.__identification__.__assumptions_print__(category='identification', **ops)
    return None