def conditional_gaussian(mu, sigma, betas):

    def conditional_gaussianize(f):

        @wraps(f)
        def conditional_gaussianized(*args, **kwds):
            '''Since this function will never
            be called directly we dont need anything here.
            '''
            # First we need to construct a vector
            # out of the args...
            x = zeros((len(args), 1))
            for i, a in enumerate(args):
                x[i, 0] = a
            sigma = conditional_gaussianized.covariance_matrix
            mu = conditional_gaussianized.joint_mu
            return 1 / (2 * math.pi * sigma.det()) ** 0.5 \
                * math.exp(-0.5 * ((x - mu).T * sigma.I * (mu - x))[0, 0])

        conditional_gaussianized.mean = mu
        conditional_gaussianized.std_dev = sigma
        conditional_gaussianized.variance = sigma ** 2
        conditional_gaussianized.raw_betas = betas
        conditional_gaussianized.argspec = get_args(f)
        conditional_gaussianized.entropy = types.MethodType(
            lambda x: len(x.joint_mu) / 2 * \
            (1 + math.log(2 * math.pi)) + \
            0.5 * math.log(x.covariance_matrix.det()), conditional_gaussianized)

        # NOTE: the joint parameters are
        # add to this function at the time of the
        # graph construction

        return conditional_gaussianized

    return conditional_gaussianize
dataset/ETHPy150Open eBay/bayesian-belief-networks/bayesian/gaussian_bayesian_network.py/conditional_gaussian/swapped operands of `-`