ezyrb.approximation.gpr.GPR

class GPR(kern=None, normalizer=True, optimization_restart=20)[source]

Multidimensional regression using Gaussian process.

Variables:
  • X_sample (numpy.ndarray) – the array containing the input points, arranged by row.

  • Y_sample (numpy.ndarray) – the array containing the output values, arranged by row.

  • model (sklearn.gaussian_process.GaussianProcessRegressor) – the regression model.

  • kern (sklearn.gaussian_process.kernels.Kernel) – kernel object from sklearn.

  • normalizer (bool) – whether to normilize values or not. Defaults to True.

  • optimization_restart (int) – number of restarts for the optimization. Defaults to 20.

Example:
>>> import ezyrb
>>> import numpy as np
>>> x = np.random.uniform(-1, 1, size=(4, 2))
>>> y = (np.sin(x[:, 0]) + np.cos(x[:, 1]**3)).reshape(-1, 1)
>>> gpr = ezyrb.GPR()
>>> gpr.fit(x, y)
>>> y_pred = gpr.predict(x)
>>> print(np.allclose(y, y_pred))
__init__(kern=None, normalizer=True, optimization_restart=20)[source]

Methods

__init__([kern, normalizer, ...])

fit(points, values)

Construct the regression given points and values.

optimal_mu(bounds[, optimization_restart])

Proposes the next sampling point by looking at the point where the Gaussian covariance is maximized.

predict(new_points[, return_variance])

Predict the mean and the variance of Gaussian distribution at given new_points.