Ejemplo n.º 1
0
 def fit(self, X_trainIn, y_trainIn):
     y_train_l = y_trainIn.reshape((y_trainIn.shape[0], 1))
     self.m = models.GPRegression(X_trainIn, y_train_l, self.kernel_ard)
     self.m.constrain_positive('')
     self.m.optimize_restarts(num_restarts=10)
     self.m.randomize()
     self.m.optimize()
Ejemplo n.º 2
0
    def _fit_gaussian_process(x,
                              y,
                              kernel=kern.RBF(1, 1., 10.),
                              num_restarts: int = 7):
        """
        Fits a Gaussian process
        """

        x, y = Metrics._prepare_inputs_for_fitting_gp(x, y)

        gp = models.GPRegression(x, y, kernel)
        gp.optimize_restarts(num_restarts=num_restarts, messages=False)

        return gp, kernel