Implementing correlation model kernels #3138

Closed
worldveil opened this Issue May 7, 2014 · 5 comments

Projects

None yet

4 participants

@worldveil

As seen here:
http://scikit-learn.org/stable/modules/gaussian_process.html#correlation-models

the Matern kernel is not implemented (as marked by TODO). What is the best route for one to take to add this kernel to scikit's library so the GP can use it?

Definition of Matern kernel:
http://en.wikipedia.org/wiki/Mat%C3%A9rn_covariance_function

Perhaps a good starting point:
http://gptools.readthedocs.org/en/latest/_modules/gptools/kernel/matern.html

EDIT: To clarify, it is something I'd like to add, and I'm wondering the best way to start such that it would be accepted.

@arjoly
Member
arjoly commented Jul 18, 2014

Thanks for your interest.

The best way would to make a pull request that adds test, documentation and the new features.
Then it would be reviewed by 2 people and merged.

@arjoly arjoly added the Enhancement label Jul 18, 2014
@worldveil

I was asking for more specific feedback about where the code should be and what the API should be in terms of inputs and outputs.

In other words what's the desired spec?

@kastnerkyle
Member

We are having serious discussions about this right now. The easiest way forward would be to make a simple function that takes parameters for properly constructing matern kernels, and a few tests to verify the function is correct. If you have the right function, refactoring it to a proper API after a decision is made in #3388 or another upcoming should be easy. That said, I think there will (and should) be some significant changes in the GP module in the very near future.

I am pushing hard for dumb kernels, because I think they are more general and useful.

An example

def matern(x1, x2, param1, param2, param3):
    something something
    return correlation_matrix (shape x1.shape[0] by x2.shape[0])

This is simple enough to be useful for anything, including other models that may use the same type of processing. The caller should be responsible for providing two identical matrices if they want autocorrelation in my opinion.

@arjoly
Member
arjoly commented Jul 20, 2014

The mattern kernel should be put in the pairwise module.

@glouppe
Member
glouppe commented Oct 19, 2015

Closing. The new implementation of gaussian processes (see #4270) now includes the Matern kernel.

See also #3885 for another implementation in the pairwise module.

@glouppe glouppe closed this Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment