FIX: Fixing bugs and innacuracies in state-space inference.

This commit is contained in:
Alexander Grigorievskiy 2016-04-06 17:35:08 +03:00
parent 07d7c4cd84
commit c374311e84
2 changed files with 7 additions and 5 deletions

View file

@ -129,14 +129,14 @@ class sde_Exponential(Exponential):
"""
self.variance.gradient = gradients[0]
self.lengthscale.gradient = gradients[1]
self.lengthscale.gradient = gradients[1] * 2.0
def sde(self):
"""
Return the state space representation of the covariance.
"""
variance = float(self.variance.values)
lengthscale = float(self.lengthscale)
lengthscale = float(self.lengthscale*2.0)
F = np.array(((-1.0/lengthscale,),))
L = np.array(((1.0,),))

View file

@ -3237,6 +3237,7 @@ class ContDescrStateSpace(DescreteStateSpace):
AB = np.dot(AB, np.vstack((np.zeros((n,n)),np.eye(n))))
Q_noise_1 = linalg.solve(AB[n:,:].T,AB[:n,:].T)
Q_noise_2 = P_inf - A.dot(P_inf).dot(A.T)
# The covariance matrix Q by matrix fraction decomposition <-
if compute_derivatives:
@ -3276,8 +3277,9 @@ class ContDescrStateSpace(DescreteStateSpace):
else:
dA = None
dQ = None
Q_noise = Q_noise_1
Q_noise = Q_noise_2
# Innacuracies have been observed when Q_noise_1 was used.
#Q_noise = Q_noise_1
# Return
@ -3484,4 +3486,4 @@ def balance_ss_model(F,L,Qc,H,Pinf,P0,dF=None,dQc=None,dPinf=None,dP0=None):
# (F,L,Qc,H,Pinf,P0,dF,dQc,dPinf,dP0)
return bF, bL, bQc, bH, bPinf, bP0, bdF, bdQc, bdPinf, bdP0, T
return bF, bL, bQc, bH, bPinf, bP0, bdF, bdQc, bdPinf, bdP0, T