Table Of Contents

Previous topic

mvpa.clfs.gpr

Next topic

mvpa.clfs.knn

This Page

Quick search

mvpa.clfs.kernel

Kernels for Gaussian Process Regression and Classification.

The comprehensive API documentation for this module, including all technical details, is available in the Epydoc-generated API reference for mvpa.clfs.kernel (for developers).

Classes

Kernel

class mvpa.clfs.kernel.Kernel

Bases: object

Kernel function base class.

compute(data1, data2=None)
compute_gradient(alphaalphaTK)
compute_lml_gradient(alphaalphaT_Kinv, data)
compute_lml_gradient_logscale(alphaalphaT_Kinv, data)
reset()
Resets the kernel dropping internal variables to the original values

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the Kernel documentation.

Full API documentation of Kernel in module mvpa.clfs.kernel.

KernelConstant

class mvpa.clfs.kernel.KernelConstant(sigma_0=1.0, **kwargs)

Bases: mvpa.clfs.kernel.Kernel

The constant kernel class.

Initialize the constant kernel instance.

Parameters:
  • sigma_0 (float) – standard deviation of the Gaussian prior probability N(0,sigma_0**2) of the intercept of the constant regression. (Defaults to 1.0)
compute(data1, data2=None)

Compute kernel matrix.

Parameters:
  • data1 (numpy.ndarray) – data
  • data2 (numpy.ndarray) – data (Defaults to None)
compute_lml_gradient(alphaalphaT_Kinv, data)
compute_lml_gradient_logscale(alphaalphaT_Kinv, data)
set_hyperparameters(hyperparameter)

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the KernelConstant documentation.

Full API documentation of KernelConstant in module mvpa.clfs.kernel.

KernelExponential

class mvpa.clfs.kernel.KernelExponential(length_scale=1.0, sigma_f=1.0, **kwargs)

Bases: mvpa.clfs.kernel.Kernel

The Exponential kernel class.

Note that it can handle a length scale for each dimension for Automtic Relevance Determination.

Initialize an Exponential kernel instance.

Parameters:
  • length_scale (float OR numpy.ndarray) – the characteristic length-scale (or length-scales) of the phenomenon under investigation. (Defaults to 1.0)
  • sigma_f (float) – Signal standard deviation. (Defaults to 1.0)
compute(data1, data2=None)

Compute kernel matrix.

Parameters:
  • data1 (numpy.ndarray) – data
  • data2 (numpy.ndarray) – data (Defaults to None)
compute_lml_gradient(alphaalphaT_Kinv, data)
Compute grandient of the kernel and return the portion of log marginal likelihood gradient due to the kernel. Shorter formula. Allows vector of lengthscales (ARD) BUT THIS LAST OPTION SEEMS NOT TO WORK FOR (CURRENTLY) UNKNOWN REASONS.
compute_lml_gradient_logscale(alphaalphaT_Kinv, data)
Compute grandient of the kernel and return the portion of log marginal likelihood gradient due to the kernel. Shorter formula. Allows vector of lengthscales (ARD). BUT THIS LAST OPTION SEEMS NOT TO WORK FOR (CURRENTLY) UNKNOWN REASONS.
gradient(data1, data2)
Compute gradient of the kernel matrix. A must for fast model selection with high-dimensional data.
set_hyperparameters(hyperparameter)

Set hyperaparmeters from a vector.

Used by model selection.

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the KernelExponential documentation.

Full API documentation of KernelExponential in module mvpa.clfs.kernel.

KernelLinear

class mvpa.clfs.kernel.KernelLinear(Sigma_p=None, sigma_0=1.0, **kwargs)

Bases: mvpa.clfs.kernel.Kernel

The linear kernel class.

Initialize the linear kernel instance.

Parameters:
  • Sigma_p (numpy.ndarray) – Covariance matrix of the Gaussian prior probability N(0,Sigma_p) on the weights of the linear regression. (Defaults to None)
  • sigma_0 (float) – the standard deviation of the Gaussian prior N(0,sigma_0**2) of the intercept of the linear regression. (Deafults to 1.0)
compute(data1, data2=None)

Compute kernel matrix. Set Sigma_p to correct dimensions and default value if necessary.

Parameters:
  • data1 (numpy.ndarray) – data
  • data2 (numpy.ndarray) – data (Defaults to None)
compute_lml_gradient(alphaalphaT_Kinv, data)
compute_lml_gradient_logscale(alphaalphaT_Kinv, data)
reset()
set_hyperparameters(hyperparameter)

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the KernelLinear documentation.

Full API documentation of KernelLinear in module mvpa.clfs.kernel.

KernelMatern_3_2

class mvpa.clfs.kernel.KernelMatern_3_2(length_scale=1.0, sigma_f=1.0, numerator=3.0, **kwargs)

Bases: mvpa.clfs.kernel.Kernel

The Matern kernel class for the case ni=3/2 or ni=5/2.

Note that it can handle a length scale for each dimension for Automtic Relevance Determination.

Initialize a Squared Exponential kernel instance.

Parameters:
  • length_scale (float OR numpy.ndarray) – the characteristic length-scale (or length-scales) of the phenomenon under investigation. (Defaults to 1.0)
  • sigma_f (float) – Signal standard deviation. (Defaults to 1.0)
  • numerator (float) – the numerator of parameter ni of Matern covariance functions. Currently only numerator=3.0 and numerator=5.0 are implemented. (Defaults to 3.0)
compute(data1, data2=None)

Compute kernel matrix.

Parameters:
  • data1 (numpy.ndarray) – data
  • data2 (numpy.ndarray) – data (Defaults to None)
gradient(data1, data2)
Compute gradient of the kernel matrix. A must for fast model selection with high-dimensional data.
set_hyperparameters(hyperparameter)

Set hyperaparmeters from a vector.

Used by model selection. Note: ‘numerator’ is not considered as an hyperparameter.

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the KernelMatern_3_2 documentation.

Full API documentation of KernelMatern_3_2 in module mvpa.clfs.kernel.

KernelMatern_5_2

class mvpa.clfs.kernel.KernelMatern_5_2(**kwargs)

Bases: mvpa.clfs.kernel.KernelMatern_3_2

The Matern kernel class for the case ni=5/2.

This kernel is just KernelMatern_3_2(numerator=5.0).

Initialize a Squared Exponential kernel instance.

Parameters:
  • length_scale (float OR numpy.ndarray) – the characteristic length-scale (or length-scales) of the phenomenon under investigation. (Defaults to 1.0)

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the KernelMatern_5_2 documentation.

Full API documentation of KernelMatern_5_2 in module mvpa.clfs.kernel.

KernelRationalQuadratic

class mvpa.clfs.kernel.KernelRationalQuadratic(length_scale=1.0, sigma_f=1.0, alpha=0.5, **kwargs)

Bases: mvpa.clfs.kernel.Kernel

The Rational Quadratic (RQ) kernel class.

Note that it can handle a length scale for each dimension for Automtic Relevance Determination.

Initialize a Squared Exponential kernel instance.

Parameters:
  • length_scale (float OR numpy.ndarray) – the characteristic length-scale (or length-scales) of the phenomenon under investigation. (Defaults to 1.0)
  • sigma_f (float) – Signal standard deviation. (Defaults to 1.0)
  • alpha (float) – The parameter of the RQ functions family. (Defaults to 2.0)
compute(data1, data2=None)

Compute kernel matrix.

Parameters:
  • data1 (numpy.ndarray) – data
  • data2 (numpy.ndarray) – data (Defaults to None)
gradient(data1, data2)
Compute gradient of the kernel matrix. A must for fast model selection with high-dimensional data.
set_hyperparameters(hyperparameter)

Set hyperaparmeters from a vector.

Used by model selection. Note: ‘alpha’ is not considered as an hyperparameter.

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the KernelRationalQuadratic documentation.

Full API documentation of KernelRationalQuadratic in module mvpa.clfs.kernel.

KernelSquaredExponential

class mvpa.clfs.kernel.KernelSquaredExponential(length_scale=1.0, sigma_f=1.0, **kwargs)

Bases: mvpa.clfs.kernel.Kernel

The Squared Exponential kernel class.

Note that it can handle a length scale for each dimension for Automtic Relevance Determination.

Initialize a Squared Exponential kernel instance.

Parameters:
  • length_scale (float OR numpy.ndarray) – the characteristic length-scale (or length-scales) of the phenomenon under investigation. (Defaults to 1.0)
  • sigma_f (float) – Signal standard deviation. (Defaults to 1.0)
compute(data1, data2=None)

Compute kernel matrix.

Parameters:
  • data1 (numpy.ndarray) – data
  • data2 (numpy.ndarray) – data (Defaults to None)
compute_lml_gradient(alphaalphaT_Kinv, data)
Compute grandient of the kernel and return the portion of log marginal likelihood gradient due to the kernel. Shorter formula. Allows vector of lengthscales (ARD).
compute_lml_gradient_logscale(alphaalphaT_Kinv, data)
Compute grandient of the kernel and return the portion of log marginal likelihood gradient due to the kernel. Hyperparameters are in log scale which is sometimes more stable. Shorter formula. Allows vector of lengthscales (ARD).
reset()
set_hyperparameters(hyperparameter)

Set hyperaparmeters from a vector.

Used by model selection.

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the KernelSquaredExponential documentation.

Full API documentation of KernelSquaredExponential in module mvpa.clfs.kernel.