Package mdp :: Package nodes :: Class GaussianProcessScikitsLearnNode
[hide private]
[frames] | no frames]

Class GaussianProcessScikitsLearnNode



The Gaussian Process model class.

This node has been automatically generated by wrapping the ``sklearn.gaussian_process.gaussian_process.GaussianProcess`` class
from the ``sklearn`` library.  The wrapped instance can be accessed
through the ``scikits_alg`` attribute.

Read more in the :ref:`User Guide <gaussian_process>`.

**Parameters**

regr : string or callable, optional
    A regression function returning an array of outputs of the linear
    regression functional basis. The number of observations n_samples
    should be greater than the size p of this basis.
    Default assumes a simple constant regression trend.
    Available built-in regression models are::


        'constant', 'linear', 'quadratic'

corr : string or callable, optional
    A stationary autocorrelation function returning the autocorrelation
    between two points x and x'.
    Default assumes a squared-exponential autocorrelation model.
    Built-in correlation models are::


        'absolute_exponential', 'squared_exponential',
        'generalized_exponential', 'cubic', 'linear'

beta0 : double array_like, optional
    The regression weight vector to perform Ordinary Kriging (OK).
    Default assumes Universal Kriging (UK) so that the vector beta of
    regression weights is estimated using the maximum likelihood
    principle.

storage_mode : string, optional
    A string specifying whether the Cholesky decomposition of the
    correlation matrix should be stored in the class (storage_mode =
    'full') or not (storage_mode = 'light').
    Default assumes storage_mode = 'full', so that the
    Cholesky decomposition of the correlation matrix is stored.
    This might be a useful parameter when one is not interested in the
    MSE and only plan to estimate the BLUP, for which the correlation
    matrix is not required.

verbose : boolean, optional
    A boolean specifying the verbose level.
    Default is verbose = False.

theta0 : double array_like, optional
    An array with shape (n_features, ) or (1, ).
    The parameters in the autocorrelation model.
    If thetaL and thetaU are also specified, theta0 is considered as
    the starting point for the maximum likelihood estimation of the
    best set of parameters.
    Default assumes isotropic autocorrelation model with theta0 = 1e-1.

thetaL : double array_like, optional
    An array with shape matching theta0's.
    Lower bound on the autocorrelation parameters for maximum
    likelihood estimation.
    Default is None, so that it skips maximum likelihood estimation and
    it uses theta0.

thetaU : double array_like, optional
    An array with shape matching theta0's.
    Upper bound on the autocorrelation parameters for maximum
    likelihood estimation.
    Default is None, so that it skips maximum likelihood estimation and
    it uses theta0.

normalize : boolean, optional
    Input X and observations y are centered and reduced wrt
    means and standard deviations estimated from the n_samples
    observations provided.
    Default is normalize = True so that data is normalized to ease
    maximum likelihood estimation.

nugget : double or ndarray, optional
    Introduce a nugget effect to allow smooth predictions from noisy
    data.  If nugget is an ndarray, it must be the same length as the
    number of data points used for the fit.
    The nugget is added to the diagonal of the assumed training covariance;
    in this way it acts as a Tikhonov regularization in the problem.  In
    the special case of the squared exponential correlation function, the
    nugget mathematically represents the variance of the input values.
    Default assumes a nugget close to machine precision for the sake of
    robustness (nugget = 10. * MACHINE_EPSILON).

optimizer : string, optional
    A string specifying the optimization algorithm to be used.
    Default uses 'fmin_cobyla' algorithm from scipy.optimize.
    Available optimizers are::


        'fmin_cobyla', 'Welch'

    'Welch' optimizer is dued to Welch et al., see reference [WBSWM1992]_.
    It consists in iterating over several one-dimensional optimizations
    instead of running one single multi-dimensional optimization.

random_start : int, optional
    The number of times the Maximum Likelihood Estimation should be
    performed from a random starting point.
    The first MLE always uses the specified starting point (theta0),
    the next starting points are picked at random according to an
    exponential distribution (log-uniform on [thetaL, thetaU]).
    Default does not use random starting point (random_start = 1).

random_state: integer or numpy.RandomState, optional
    The generator used to shuffle the sequence of coordinates of theta in
    the Welch optimizer. If an integer is given, it fixes the seed.
    Defaults to the global numpy random number generator.


**Attributes**

``theta_`` : array
    Specified theta OR the best set of autocorrelation parameters (the         sought maximizer of the reduced likelihood function).

``reduced_likelihood_function_value_`` : array
    The optimal reduced likelihood function value.

**Examples**

>>> import numpy as np
>>> from sklearn.gaussian_process import GaussianProcess
>>> X = np.array([[1., 3., 5., 6., 7., 8.]]).T
>>> y = (X * np.sin(X)).ravel()
>>> gp = GaussianProcess(theta0=0.1, thetaL=.001, thetaU=1.)
>>> gp.fit(X, y)                                      # doctest: +ELLIPSIS
GaussianProcess(beta0=None...
        ...

**Notes**

The presentation implementation is based on a translation of the DACE
Matlab toolbox, see reference [NLNS2002]_.

**References**


.. [NLNS2002] `H.B. Nielsen, S.N. Lophaven, H. B. Nielsen and J.
    Sondergaard.  DACE - A MATLAB Kriging Toolbox.` (2002)
    http://www2.imm.dtu.dk/~hbn/dace/dace.pdf

.. [WBSWM1992] `W.J. Welch, R.J. Buck, J. Sacks, H.P. Wynn, T.J. Mitchell,
    and M.D.  Morris (1992). Screening, predicting, and computer
    experiments.  Technometrics, 34(1) 15--25.`
    http://www.jstor.org/pss/1269548

Instance Methods [hide private]
 
__init__(self, input_dim=None, output_dim=None, dtype=None, **kwargs)
The Gaussian Process model class.
 
_execute(self, x)
 
_get_supported_dtypes(self)
Return the list of dtypes supported by this node. The types can be specified in any format allowed by numpy.dtype.
 
_stop_training(self, **kwargs)
Concatenate the collected data in a single array.
 
execute(self, x)
This function evaluates the Gaussian Process model at x.
 
stop_training(self, **kwargs)
The Gaussian Process model fitting method.

Inherited from unreachable.newobject: __long__, __native__, __nonzero__, __unicode__, next

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

    Inherited from Cumulator
 
_train(self, *args)
Collect all input data in a list.
 
train(self, *args)
Collect all input data in a list.
    Inherited from Node
 
__add__(self, other)
 
__call__(self, x, *args, **kwargs)
Calling an instance of Node is equivalent to calling its execute method.
 
__repr__(self)
repr(x)
 
__str__(self)
str(x)
 
_check_input(self, x)
 
_check_output(self, y)
 
_check_train_args(self, x, *args, **kwargs)
 
_get_train_seq(self)
 
_if_training_stop_training(self)
 
_inverse(self, x)
 
_pre_execution_checks(self, x)
This method contains all pre-execution checks.
 
_pre_inversion_checks(self, y)
This method contains all pre-inversion checks.
 
_refcast(self, x)
Helper function to cast arrays to the internal dtype.
 
_set_dtype(self, t)
 
_set_input_dim(self, n)
 
_set_output_dim(self, n)
 
copy(self, protocol=None)
Return a deep copy of the node.
 
get_current_train_phase(self)
Return the index of the current training phase.
 
get_dtype(self)
Return dtype.
 
get_input_dim(self)
Return input dimensions.
 
get_output_dim(self)
Return output dimensions.
 
get_remaining_train_phase(self)
Return the number of training phases still to accomplish.
 
get_supported_dtypes(self)
Return dtypes supported by the node as a list of dtype objects.
 
has_multiple_training_phases(self)
Return True if the node has multiple training phases.
 
inverse(self, y, *args, **kwargs)
Invert y.
 
is_training(self)
Return True if the node is in the training phase, False otherwise.
 
save(self, filename, protocol=-1)
Save a pickled serialization of the node to filename. If filename is None, return a string.
 
set_dtype(self, t)
Set internal structures' dtype.
 
set_input_dim(self, n)
Set input dimensions.
 
set_output_dim(self, n)
Set output dimensions.
Static Methods [hide private]
 
is_invertible()
Return True if the node can be inverted, False otherwise.
 
is_trainable()
Return True if the node can be trained, False otherwise.
Properties [hide private]

Inherited from object: __class__

    Inherited from Node
  _train_seq
List of tuples:
  dtype
dtype
  input_dim
Input dimensions
  output_dim
Output dimensions
  supported_dtypes
Supported dtypes
Method Details [hide private]

__init__(self, input_dim=None, output_dim=None, dtype=None, **kwargs)
(Constructor)

 

The Gaussian Process model class.

This node has been automatically generated by wrapping the ``sklearn.gaussian_process.gaussian_process.GaussianProcess`` class
from the ``sklearn`` library.  The wrapped instance can be accessed
through the ``scikits_alg`` attribute.

Read more in the :ref:`User Guide <gaussian_process>`.

**Parameters**

regr : string or callable, optional
    A regression function returning an array of outputs of the linear
    regression functional basis. The number of observations n_samples
    should be greater than the size p of this basis.
    Default assumes a simple constant regression trend.
    Available built-in regression models are::


        'constant', 'linear', 'quadratic'

corr : string or callable, optional
    A stationary autocorrelation function returning the autocorrelation
    between two points x and x'.
    Default assumes a squared-exponential autocorrelation model.
    Built-in correlation models are::


        'absolute_exponential', 'squared_exponential',
        'generalized_exponential', 'cubic', 'linear'

beta0 : double array_like, optional
    The regression weight vector to perform Ordinary Kriging (OK).
    Default assumes Universal Kriging (UK) so that the vector beta of
    regression weights is estimated using the maximum likelihood
    principle.

storage_mode : string, optional
    A string specifying whether the Cholesky decomposition of the
    correlation matrix should be stored in the class (storage_mode =
    'full') or not (storage_mode = 'light').
    Default assumes storage_mode = 'full', so that the
    Cholesky decomposition of the correlation matrix is stored.
    This might be a useful parameter when one is not interested in the
    MSE and only plan to estimate the BLUP, for which the correlation
    matrix is not required.

verbose : boolean, optional
    A boolean specifying the verbose level.
    Default is verbose = False.

theta0 : double array_like, optional
    An array with shape (n_features, ) or (1, ).
    The parameters in the autocorrelation model.
    If thetaL and thetaU are also specified, theta0 is considered as
    the starting point for the maximum likelihood estimation of the
    best set of parameters.
    Default assumes isotropic autocorrelation model with theta0 = 1e-1.

thetaL : double array_like, optional
    An array with shape matching theta0's.
    Lower bound on the autocorrelation parameters for maximum
    likelihood estimation.
    Default is None, so that it skips maximum likelihood estimation and
    it uses theta0.

thetaU : double array_like, optional
    An array with shape matching theta0's.
    Upper bound on the autocorrelation parameters for maximum
    likelihood estimation.
    Default is None, so that it skips maximum likelihood estimation and
    it uses theta0.

normalize : boolean, optional
    Input X and observations y are centered and reduced wrt
    means and standard deviations estimated from the n_samples
    observations provided.
    Default is normalize = True so that data is normalized to ease
    maximum likelihood estimation.

nugget : double or ndarray, optional
    Introduce a nugget effect to allow smooth predictions from noisy
    data.  If nugget is an ndarray, it must be the same length as the
    number of data points used for the fit.
    The nugget is added to the diagonal of the assumed training covariance;
    in this way it acts as a Tikhonov regularization in the problem.  In
    the special case of the squared exponential correlation function, the
    nugget mathematically represents the variance of the input values.
    Default assumes a nugget close to machine precision for the sake of
    robustness (nugget = 10. * MACHINE_EPSILON).

optimizer : string, optional
    A string specifying the optimization algorithm to be used.
    Default uses 'fmin_cobyla' algorithm from scipy.optimize.
    Available optimizers are::


        'fmin_cobyla', 'Welch'

    'Welch' optimizer is dued to Welch et al., see reference [WBSWM1992]_.
    It consists in iterating over several one-dimensional optimizations
    instead of running one single multi-dimensional optimization.

random_start : int, optional
    The number of times the Maximum Likelihood Estimation should be
    performed from a random starting point.
    The first MLE always uses the specified starting point (theta0),
    the next starting points are picked at random according to an
    exponential distribution (log-uniform on [thetaL, thetaU]).
    Default does not use random starting point (random_start = 1).

random_state: integer or numpy.RandomState, optional
    The generator used to shuffle the sequence of coordinates of theta in
    the Welch optimizer. If an integer is given, it fixes the seed.
    Defaults to the global numpy random number generator.


**Attributes**

``theta_`` : array
    Specified theta OR the best set of autocorrelation parameters (the         sought maximizer of the reduced likelihood function).

``reduced_likelihood_function_value_`` : array
    The optimal reduced likelihood function value.

**Examples**

>>> import numpy as np
>>> from sklearn.gaussian_process import GaussianProcess
>>> X = np.array([[1., 3., 5., 6., 7., 8.]]).T
>>> y = (X * np.sin(X)).ravel()
>>> gp = GaussianProcess(theta0=0.1, thetaL=.001, thetaU=1.)
>>> gp.fit(X, y)                                      # doctest: +ELLIPSIS
GaussianProcess(beta0=None...
        ...

**Notes**

The presentation implementation is based on a translation of the DACE
Matlab toolbox, see reference [NLNS2002]_.

**References**


.. [NLNS2002] `H.B. Nielsen, S.N. Lophaven, H. B. Nielsen and J.
    Sondergaard.  DACE - A MATLAB Kriging Toolbox.` (2002)
    http://www2.imm.dtu.dk/~hbn/dace/dace.pdf

.. [WBSWM1992] `W.J. Welch, R.J. Buck, J. Sacks, H.P. Wynn, T.J. Mitchell,
    and M.D.  Morris (1992). Screening, predicting, and computer
    experiments.  Technometrics, 34(1) 15--25.`
    http://www.jstor.org/pss/1269548

Overrides: object.__init__

_execute(self, x)

 
Overrides: Node._execute

_get_supported_dtypes(self)

 
Return the list of dtypes supported by this node. The types can be specified in any format allowed by numpy.dtype.
Overrides: Node._get_supported_dtypes

_stop_training(self, **kwargs)

 
Concatenate the collected data in a single array.
Overrides: Node._stop_training

execute(self, x)

 

This function evaluates the Gaussian Process model at x.

This node has been automatically generated by wrapping the sklearn.gaussian_process.gaussian_process.GaussianProcess class from the sklearn library. The wrapped instance can be accessed through the scikits_alg attribute.

Parameters

X : array_like
An array with shape (n_eval, n_features) giving the point(s) at which the prediction(s) should be made.
eval_MSE : boolean, optional
A boolean specifying whether the Mean Squared Error should be evaluated or not. Default assumes evalMSE = False and evaluates only the BLUP (mean prediction).
batch_size : integer, optional
An integer giving the maximum number of points that can be evaluated simultaneously (depending on the available memory). Default is None so that all given points are evaluated at the same time.

Returns

y : array_like, shape (n_samples, ) or (n_samples, n_targets)
An array with shape (n_eval, ) if the Gaussian Process was trained on an array of shape (n_samples, ) or an array with shape (n_eval, n_targets) if the Gaussian Process was trained on an array of shape (n_samples, n_targets) with the Best Linear Unbiased Prediction at x.
MSE : array_like, optional (if eval_MSE == True)
An array with shape (n_eval, ) or (n_eval, n_targets) as with y, with the Mean Squared Error at x.
Overrides: Node.execute

is_invertible()
Static Method

 
Return True if the node can be inverted, False otherwise.
Overrides: Node.is_invertible
(inherited documentation)

is_trainable()
Static Method

 
Return True if the node can be trained, False otherwise.
Overrides: Node.is_trainable

stop_training(self, **kwargs)

 

The Gaussian Process model fitting method.

This node has been automatically generated by wrapping the sklearn.gaussian_process.gaussian_process.GaussianProcess class from the sklearn library. The wrapped instance can be accessed through the scikits_alg attribute.

Parameters

X : double array_like
An array with shape (n_samples, n_features) with the input at which observations were made.
y : double array_like
An array with shape (n_samples, ) or shape (n_samples, n_targets) with the observations of the output to be predicted.

Returns

gp : self
A fitted Gaussian Process model object awaiting data to perform predictions.
Overrides: Node.stop_training