mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-02 14:45:15 +02:00
Fixed deprecated warning and sense_axes bug
This commit is contained in:
parent
e60eb4e236
commit
d209b963f2
2 changed files with 7 additions and 7 deletions
|
|
@ -82,7 +82,7 @@ def BGPLVM_oil(optimize=True, N=100, Q=10, M=15, max_f_eval=300):
|
||||||
m.ensure_default_constraints()
|
m.ensure_default_constraints()
|
||||||
|
|
||||||
y = m.likelihood.Y[0, :]
|
y = m.likelihood.Y[0, :]
|
||||||
fig, (latent_axes, hist_axes) = plt.subplots(1, 2)
|
fig, (latent_axes, sense_axes) = plt.subplots(1, 2)
|
||||||
plt.sca(latent_axes)
|
plt.sca(latent_axes)
|
||||||
m.plot_latent()
|
m.plot_latent()
|
||||||
data_show = GPy.util.visualize.vector_show(y)
|
data_show = GPy.util.visualize.vector_show(y)
|
||||||
|
|
@ -362,7 +362,7 @@ def brendan_faces():
|
||||||
|
|
||||||
# optimize
|
# optimize
|
||||||
m.ensure_default_constraints()
|
m.ensure_default_constraints()
|
||||||
m.optimize(messages=1, max_f_eval=10000)
|
# m.optimize(messages=1, max_f_eval=10000)
|
||||||
|
|
||||||
ax = m.plot_latent()
|
ax = m.plot_latent()
|
||||||
y = m.likelihood.Y[0, :]
|
y = m.likelihood.Y[0, :]
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import cPickle
|
||||||
import types
|
import types
|
||||||
import ctypes
|
import ctypes
|
||||||
from ctypes import byref, c_char, c_int, c_double # TODO
|
from ctypes import byref, c_char, c_int, c_double # TODO
|
||||||
#import scipy.lib.lapack.flapack
|
#import scipy.lib.lapack
|
||||||
import scipy as sp
|
import scipy as sp
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -63,7 +63,7 @@ def _mdot_r(a,b):
|
||||||
|
|
||||||
def jitchol(A,maxtries=5):
|
def jitchol(A,maxtries=5):
|
||||||
A = np.asfortranarray(A)
|
A = np.asfortranarray(A)
|
||||||
L,info = linalg.lapack.flapack.dpotrf(A,lower=1)
|
L,info = linalg.lapack.dpotrf(A,lower=1)
|
||||||
if info ==0:
|
if info ==0:
|
||||||
return L
|
return L
|
||||||
else:
|
else:
|
||||||
|
|
@ -124,7 +124,7 @@ def pdinv(A, *args):
|
||||||
L = jitchol(A, *args)
|
L = jitchol(A, *args)
|
||||||
logdet = 2.*np.sum(np.log(np.diag(L)))
|
logdet = 2.*np.sum(np.log(np.diag(L)))
|
||||||
Li = chol_inv(L)
|
Li = chol_inv(L)
|
||||||
Ai = linalg.lapack.flapack.dpotri(L)[0]
|
Ai = linalg.lapack.dpotri(L)[0]
|
||||||
Ai = np.tril(Ai) + np.tril(Ai,-1).T
|
Ai = np.tril(Ai) + np.tril(Ai,-1).T
|
||||||
|
|
||||||
return Ai, L, Li, logdet
|
return Ai, L, Li, logdet
|
||||||
|
|
@ -139,7 +139,7 @@ def chol_inv(L):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return linalg.lapack.flapack.dtrtri(L, lower = True)[0]
|
return linalg.lapack.dtrtri(L, lower = True)[0]
|
||||||
|
|
||||||
|
|
||||||
def multiple_pdinv(A):
|
def multiple_pdinv(A):
|
||||||
|
|
@ -156,7 +156,7 @@ def multiple_pdinv(A):
|
||||||
N = A.shape[-1]
|
N = A.shape[-1]
|
||||||
chols = [jitchol(A[:,:,i]) for i in range(N)]
|
chols = [jitchol(A[:,:,i]) for i in range(N)]
|
||||||
halflogdets = [np.sum(np.log(np.diag(L[0]))) for L in chols]
|
halflogdets = [np.sum(np.log(np.diag(L[0]))) for L in chols]
|
||||||
invs = [linalg.lapack.flapack.dpotri(L[0],True)[0] for L in chols]
|
invs = [linalg.lapack.dpotri(L[0],True)[0] for L in chols]
|
||||||
invs = [np.triu(I)+np.triu(I,1).T for I in invs]
|
invs = [np.triu(I)+np.triu(I,1).T for I in invs]
|
||||||
return np.dstack(invs),np.array(halflogdets)
|
return np.dstack(invs),np.array(halflogdets)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue