mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-23 15:48:09 +02:00
Merge branch 'devel' into params
Conflicts: GPy/core/transformations.py GPy/kern/parts/kernpart.py
This commit is contained in:
commit
c2d217e72c
77 changed files with 3608 additions and 807 deletions
|
|
@ -51,7 +51,7 @@ def dpotri(A, lower=0):
|
|||
|
||||
:param A: Matrix A
|
||||
:param lower: is matrix lower (true) or upper (false)
|
||||
:returns:
|
||||
:returns: A inverse
|
||||
"""
|
||||
return lapack.dpotri(A, lower=lower)
|
||||
|
||||
|
|
|
|||
35
GPy/util/multioutput.py
Normal file
35
GPy/util/multioutput.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import numpy as np
|
||||
import warnings
|
||||
from .. import kern
|
||||
|
||||
def build_lcm(input_dim, num_outputs, CK = [], NC = [], W_columns=1,W=None,kappa=None):
|
||||
#TODO build_icm or build_lcm
|
||||
"""
|
||||
Builds a kernel for a linear coregionalization model
|
||||
|
||||
:input_dim: Input dimensionality
|
||||
:num_outputs: Number of outputs
|
||||
:param CK: List of coregionalized kernels (i.e., this will be multiplied by a coregionalize kernel).
|
||||
:param K: List of kernels that will be added up together with CK, but won't be multiplied by a coregionalize kernel
|
||||
:param W_columns: number tuples of the corregionalization parameters 'coregion_W'
|
||||
:type W_columns: integer
|
||||
"""
|
||||
|
||||
for k in CK:
|
||||
if k.input_dim <> input_dim:
|
||||
k.input_dim = input_dim
|
||||
warnings.warn("kernel's input dimension overwritten to fit input_dim parameter.")
|
||||
|
||||
for k in NC:
|
||||
if k.input_dim <> input_dim + 1:
|
||||
k.input_dim = input_dim + 1
|
||||
warnings.warn("kernel's input dimension overwritten to fit input_dim parameter.")
|
||||
|
||||
kernel = CK[0].prod(kern.coregionalize(num_outputs,W_columns,W,kappa),tensor=True)
|
||||
for k in CK[1:]:
|
||||
k_coreg = kern.coregionalize(num_outputs,W_columns,W,kappa)
|
||||
kernel += k.prod(k_coreg,tensor=True)
|
||||
for k in NC:
|
||||
kernel += k
|
||||
|
||||
return kernel
|
||||
|
|
@ -32,4 +32,15 @@ def std_norm_cdf(x):
|
|||
x = float(x)
|
||||
return weave.inline(code,arg_names=['x'],support_code=support_code)
|
||||
|
||||
def inv_std_norm_cdf(x):
|
||||
"""
|
||||
Inverse cumulative standard Gaussian distribution
|
||||
Based on Winitzki, S. (2008)
|
||||
"""
|
||||
z = 2*x -1
|
||||
ln1z2 = np.log(1-z**2)
|
||||
a = 8*(np.pi -3)/(3*np.pi*(4-np.pi))
|
||||
b = 2/(np.pi * a) + ln1z2/2
|
||||
inv_erf = np.sign(z) * np.sqrt( np.sqrt(b**2 - ln1z2/a) - b )
|
||||
return np.sqrt(2) * inv_erf
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue