diff --git a/GPy/kern/constructors.py b/GPy/kern/constructors.py index d1e2885a..5ae4e419 100644 --- a/GPy/kern/constructors.py +++ b/GPy/kern/constructors.py @@ -298,3 +298,12 @@ def independent_outputs(k): assert (sl.start is None) and (sl.stop is None), "cannot adjust input slices! (TODO)" _parts = [parts.independent_outputs.IndependentOutputs(p) for p in k.parts] return kern(k.input_dim+1,_parts) + +def hierarchical(k): + """ + Construct a kernel with independent outputs from an existing kernel + """ + # for sl in k.input_slices: + # assert (sl.start is None) and (sl.stop is None), "cannot adjust input slices! (TODO)" + _parts = [parts.hierarchical.Hierarchical(k.parts)] + return kern(k.input_dim+1,_parts) diff --git a/GPy/kern/parts/__init__.py b/GPy/kern/parts/__init__.py index 68762afc..f9b40888 100644 --- a/GPy/kern/parts/__init__.py +++ b/GPy/kern/parts/__init__.py @@ -19,3 +19,4 @@ import rbf import spline import symmetric import white +import hierarchical diff --git a/GPy/kern/parts/hierarchical.py b/GPy/kern/parts/hierarchical.py index 98f4a183..db495ba7 100644 --- a/GPy/kern/parts/hierarchical.py +++ b/GPy/kern/parts/hierarchical.py @@ -5,7 +5,7 @@ from kernpart import Kernpart import numpy as np from independent_outputs import index_to_slices -class hierarchical(Kernpart): +class Hierarchical(Kernpart): """ A kernel part which can reopresent a hierarchy of indepencnce: a gerenalisation of independent_outputs