How to use the causallib.simulation.CausalSimulator3.CausalSimulator3._affine_link function in causallib

To help you get started, we’ve selected a few causallib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / causallib / causallib / simulation / CausalSimulator3.py View on Github external
"""
        creates a variable linearly dependant on its parents and then log it: log(beta*X)
        Args:
            X_parents (pd.DataFrame): a (num_samples x num_parents) matrix containing the data (over all samples or
                                      samples or patients) of the variables which are topological parents of the current
                                      variable
            beta (pd.Series): Optional, a given Series which index corresponds to the parents variables
                              (X_parents.columns)

        Returns:
            (pd.Series, pd.Series): 2-element tuple containing:

            - **x_new** (*pd.Series*): Newly created signal.
            - **beta** (*pd.Series*): The coefficients used to create the linear link.
        """
        x_new, beta = CausalSimulator3._affine_link(X_parents=X_parents, beta=beta)
        x_new = np.log(np.abs(x_new))  # type: pd.Series
        return x_new, beta
github IBM / causallib / causallib / simulation / CausalSimulator3.py View on Github external
"""
        creates a variable linearly dependant on its parents and then exponent it: exp(beta*X)
        Args:
            X_parents (pd.DataFrame): a (num_samples x num_parents) matrix containing the data (over all samples or
                                      samples or patients) of the variables which are topological parents of the current
                                      variable
            beta (pd.Series): Optional, a given Series which index corresponds to the parents variables
                              (X_parents.columns)

        Returns:
            (pd.Series, pd.Series): 2-element tuple containing:

            - **x_new** (*pd.Series*): Newly created signal.
            - **beta** (*pd.Series*): The coefficients used to create the linear link.
        """
        x_new, beta = CausalSimulator3._affine_link(X_parents=X_parents, beta=beta)
        x_new = np.exp(x_new)  # type: pd.Series
        return x_new, beta
github IBM / causallib / causallib / simulation / CausalSimulator3.py View on Github external
                         "affine": lambda x, beta=None: CausalSimulator3._affine_link(x, beta),
                         "exp": lambda x, beta=None: CausalSimulator3._exp_linking(x, beta),

causallib

A Python package for flexible and modular causal inference modeling

Apache-2.0
Latest version published 4 months ago

Package Health Score

67 / 100
Full package analysis

Similar packages