Implementing correlation model kernels #3138

worldveil opened this Issue May 7, 2014 · 5 comments


None yet

4 participants


As seen here:

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:

Perhaps a good starting point:

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

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?


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 commented Jul 20, 2014

The mattern kernel should be put in the pairwise module.

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