예제 #1
0
    def predict(self,
                Xnew,
                point=None,
                diag=False,
                pred_noise=False,
                model=None):
        R"""
        Return the mean vector and covariance matrix of the conditional
        distribution as numpy arrays, given a `point`, such as the MAP
        estimate or a sample from a `trace`.

        Parameters
        ----------
        Xnew: array-like
            Function input values.  If one-dimensional, must be a column
            vector with shape `(n, 1)`.
        point: pymc.model.Point
            A specific point to condition on.
        diag: bool
            If `True`, return the diagonal instead of the full covariance
            matrix.  Default is `False`.
        pred_noise: bool
            Whether or not observation noise is included in the conditional.
            Default is `False`.
        """
        mu, cov = self._predict_at(Xnew, diag, pred_noise)
        return replace_with_values([mu, cov], replacements=point, model=model)
예제 #2
0
    def predict(
        self, Xnew, point=None, diag=False, pred_noise=False, given=None, jitter=0.0, model=None
    ):
        R"""
        Return the mean vector and covariance matrix of the conditional
        distribution as numpy arrays, given a `point`, such as the MAP
        estimate or a sample from a `trace`.

        Parameters
        ----------
        Xnew: array-like
            Function input values.  If one-dimensional, must be a column
            vector with shape `(n, 1)`.
        point: pymc.model.Point
            A specific point to condition on.
        diag: bool
            If `True`, return the diagonal instead of the full covariance
            matrix.  Default is `False`.
        pred_noise: bool
            Whether or not observation noise is included in the conditional.
            Default is `False`.
        given: dict
            Same as `conditional` method.
        jitter: scalar
            A small correction added to the diagonal of positive semi-definite
            covariance matrices to ensure numerical stability.  For conditionals
            the default value is 0.0.
        """
        if given is None:
            given = {}
        mu, cov = self._predict_at(Xnew, diag, pred_noise, given, jitter)
        return replace_with_values([mu, cov], replacements=point, model=model)