(self, theta)
return -ll if np.isfinite(ll) else 1e25
Returns the negative marginal log likelihood (+ the prior) for
        a hyperparameter configuration theta.
        (negative because we use scipy minimize for optimization)

        Parameters
        ----------
        theta : np.ndarray(H)
            Hyperparameter vector. Note that all hyperparameter are
            on a log scale.

        Returns
        ----------
        float
            lnlikelihood + prior
Returns the negative marginal log likelihood (+ the prior) for
        a hyperparameter configuration theta.
        (negative because we use scipy minimize for optimization)
Returns the negative marginal log likelihood ( + the prior ) for a hyperparameter configuration theta . ( negative because we use scipy minimize for optimization )
def nll(self, theta):
        """
        Returns the negative marginal log likelihood (+ the prior) for
        a hyperparameter configuration theta.
        (negative because we use scipy minimize for optimization)

        Parameters
        ----------
        theta : np.ndarray(H)
            Hyperparameter vector. Note that all hyperparameter are
            on a log scale.

        Returns
        ----------
        float
            lnlikelihood + prior
        """
        # Specify bounds to keep things sane
        if np.any((-20 > theta) + (theta > 20)):
            return 1e25

        # The last entry of theta is always the noise
        self.gp.kernel.set_parameter_vector(theta[:-1])
        noise = np.exp(theta[-1])  # sigma^2

        try:
            self.gp.compute(self.X, yerr=np.sqrt(noise))
        except np.linalg.LinAlgError:
            return 1e25

        ll = self.gp.log_likelihood(self.y, quiet=True)

        # Add prior
        if self.prior is not None:
            ll += self.prior.lnprob(theta)

        # We add a minus here because scipy is minimizing
        return -ll if np.isfinite(ll) else 1e25
def nll ( self , theta ) : # Specify bounds to keep things sane if np . any ( ( - 20 > theta ) + ( theta > 20 ) ) : return 1e25 # The last entry of theta is always the noise self . gp . kernel . set_parameter_vector ( theta [ : - 1 ] ) noise = np . exp ( theta [ - 1 ] ) # sigma^2 try : self . gp . compute ( self . X , yerr = np . sqrt ( noise ) ) except np . linalg . LinAlgError : return 1e25 ll = self . gp . log_likelihood ( self . y , quiet = True ) # Add prior if self . prior is not None : ll += self . prior . lnprob ( theta ) # We add a minus here because scipy is minimizing return - ll if np . isfinite ( ll ) else 1e25