def query(self, **kwds):

        # Ensure the evidence variables are actually
        # present
        invalid_vars = [v for v in kwds.keys() if v not in self.nodes]
        if invalid_vars:
            raise VariableNotInGraphError(invalid_vars)

        mu, sigma = self.get_joint_parameters()

        # Iteratively apply the evidence...
        result = dict()
        result['evidence'] = kwds

        for k, v in kwds.items():
            x = MeansVector([[v]], names=[k])
            sigma_yy, sigma_yx, sigma_xy, sigma_xx = (
                sigma.split(k))
            mu_y, mu_x = mu.split(k)
            # See equations (6) and (7) of CK
            mu_y_given_x = MeansVector(
                (mu_y + sigma_yx * sigma_xx.I * (x - mu_x)).rows,
                names = mu_y.name_ordering)
            sigma_y_given_x = CovarianceMatrix(
                (sigma_yy - sigma_yx * sigma_xx.I * sigma_xy).rows,
                names=sigma_yy.name_ordering)
            sigma = sigma_y_given_x
            mu = mu_y_given_x

        result['joint'] = dict(mu=mu, sigma=sigma)
        return result
dataset/ETHPy150Open eBay/bayesian-belief-networks/bayesian/gaussian_bayesian_network.py/GaussianBayesianGraph.query/original