mmgp.regressor

Classes

RegressorBase

This class implements a regression model for different algorithms

Module Contents

class mmgp.regressor.RegressorBase[source]

Bases: object

This class implements a regression model for different algorithms

Initialize the Regressor with the specified algorithm and options.

Parameters:
  • algo (str) – The regression algorithm to use.

  • options (dict) – A dictionary of options specific to the chosen algorithm. Allowed fields are “kernel”, “optim”, “num_restarts”, “max_iters” and “anisotropic”.

Raises:

AssertionError – If the specified algorithm is not supported.

Example

from mmgp.regressor import Regressor
options = { 'kernel': 'Matern52', 'optim': 'bfgs', 'num_restarts': 1, 'max_iters': 1000, 'anisotropic': True }
regressor = Regressor('GPy', options)
input_dim = None[source]
output_dim = None[source]
options = None[source]
algo = None[source]
kmodel = None[source]
abstractmethod fit(X: numpy.ndarray, y: numpy.ndarray) Self[source]

Train the regression model on the provided data.

Parameters:
  • X (np.ndarray) – The input features for training.

  • y (np.ndarray) – The target values for training.

abstractmethod predict(X: numpy.ndarray) numpy.ndarray[source]

Make predictions using the trained regression model.

Parameters:

X (np.ndarray) – The input features for making predictions.

Returns:

Predicted target values.

Return type:

np.ndarray

abstractmethod predict_Monte_Carlo_draws(X: numpy.ndarray, size: int = 100) numpy.ndarray[source]

Generate Monte Carlo draws from the trained regression model.

Parameters:
  • X (np.ndarray) – The input features for generating draws.

  • size (int, optional) – The number of Monte Carlo draws to generate. Defaults to 100.

Returns:

Monte Carlo draws from the posterior of the regression model.

Return type:

np.ndarray