mmgp.backends.scikit_learn

Classes

Regressor

scikit-learn regressor

Module Contents

class mmgp.backends.scikit_learn.Regressor(options: dict)[source]

Bases: mmgp.regressor.RegressorBase

scikit-learn regressor

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”.

algo = 'scikit-learn'[source]
options[source]
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.

predict(X: numpy.ndarray, return_var: bool) numpy.ndarray[source]

Make predictions using the trained regression model.

Parameters:
  • X (np.ndarray) – The input features for making predictions. Array of size 1 x self.input_dim

  • return_var (bool) – True if prediction variance is computed

Returns:

Predicted target values (and variances). One array (two arrays) of size 1 x self.output_dim

Return type:

np.ndarray

predict_Monte_Carlo_draw(X: numpy.ndarray) numpy.ndarray[source]

Generate Monte Carlo draws from the trained regression model.

Parameters:

X (np.ndarray) – The input features for generating draws. Array of size 1 x self.input_dim

Returns:

Monte Carlo draw from the posterior of the regression model. Array of size 1 x self.output_dim

Return type:

np.ndarray