(self)
return theta
Optimizes the marginal log likelihood and returns the best found
        hyperparameter configuration theta.

        Returns
        -------
        theta : np.ndarray(H)
            Hyperparameter vector that maximizes the marginal log likelihood
Optimizes the marginal log likelihood and returns the best found
        hyperparameter configuration theta.
Optimizes the marginal log likelihood and returns the best found hyperparameter configuration theta .
def optimize(self):
        """
        Optimizes the marginal log likelihood and returns the best found
        hyperparameter configuration theta.

        Returns
        -------
        theta : np.ndarray(H)
            Hyperparameter vector that maximizes the marginal log likelihood
        """
        # Start optimization from the previous hyperparameter configuration
        p0 = self.gp.kernel.get_parameter_vector()
        p0 = np.append(p0, np.log(self.noise))

        if self.use_gradients:
            theta, _, _ = optimize.minimize(self.nll, p0,
                                            method="BFGS",
                                            jac=self.grad_nll)
        else:
            try:
                results = optimize.minimize(self.nll, p0, method='L-BFGS-B')
                theta = results.x
            except ValueError:
                logging.error("Could not find a valid hyperparameter configuration! Use initial configuration")
                theta = p0

        return theta
def optimize ( self ) : # Start optimization from the previous hyperparameter configuration p0 = self . gp . kernel . get_parameter_vector ( ) p0 = np . append ( p0 , np . log ( self . noise ) ) if self . use_gradients : theta , _ , _ = optimize . minimize ( self . nll , p0 , method = "BFGS" , jac = self . grad_nll ) else : try : results = optimize . minimize ( self . nll , p0 , method = 'L-BFGS-B' ) theta = results . x except ValueError : logging . error ( "Could not find a valid hyperparameter configuration! Use initial configuration" ) theta = p0 return theta