mmgp.regressor ============== .. py:module:: mmgp.regressor Classes ------- .. autoapisummary:: mmgp.regressor.RegressorBase Module Contents --------------- .. py:class:: RegressorBase Bases: :py:obj:`object` This class implements a regression model for different algorithms Initialize the Regressor with the specified algorithm and options. :param algo: The regression algorithm to use. :type algo: str :param options: A dictionary of options specific to the chosen algorithm. Allowed fields are "kernel", "optim", "num_restarts", "max_iters" and "anisotropic". :type options: dict :raises AssertionError: If the specified algorithm is not supported. .. rubric:: Example .. code-block:: python from mmgp.regressor import Regressor options = { 'kernel': 'Matern52', 'optim': 'bfgs', 'num_restarts': 1, 'max_iters': 1000, 'anisotropic': True } regressor = Regressor('GPy', options) .. py:attribute:: input_dim :value: None .. py:attribute:: output_dim :value: None .. py:attribute:: options :value: None .. py:attribute:: algo :value: None .. py:attribute:: kmodel :value: None .. py:method:: fit(X: numpy.ndarray, y: numpy.ndarray) -> Self :abstractmethod: Train the regression model on the provided data. :param X: The input features for training. :type X: np.ndarray :param y: The target values for training. :type y: np.ndarray .. py:method:: predict(X: numpy.ndarray) -> numpy.ndarray :abstractmethod: Make predictions using the trained regression model. :param X: The input features for making predictions. :type X: np.ndarray :returns: Predicted target values. :rtype: np.ndarray .. py:method:: predict_Monte_Carlo_draws(X: numpy.ndarray, size: int = 100) -> numpy.ndarray :abstractmethod: Generate Monte Carlo draws from the trained regression model. :param X: The input features for generating draws. :type X: np.ndarray :param size: The number of Monte Carlo draws to generate. Defaults to 100. :type size: int, optional :returns: Monte Carlo draws from the posterior of the regression model. :rtype: np.ndarray