fixed bug that prevented the smoother from running.

This commit is contained in:
Arno Solin 2013-11-28 14:11:44 +02:00
parent 5fc80202ab
commit 95948c760e

View file

@ -77,15 +77,15 @@ class StateSpace(Model):
#return self.kf_likelihood_g(F,L,Qc,self.sigma2,H,Pinf,dF,dQc,dPinf,self.X,self.Y)
return False
def predict_raw(self, Xnew, Y=None, filteronly=False):
def predict_raw(self, Xnew, Ynew=None, filteronly=False):
# Set defaults
if Y is None:
Y = self.Y
if Ynew is None:
Ynew = self.Y
# Make a single matrix containing training and testing points
X = np.vstack((self.X, Xnew))
Y = np.vstack((Y, np.nan*np.zeros(Xnew.shape)))
Y = np.vstack((Ynew, np.nan*np.zeros(Xnew.shape)))
# Sort the matrix (save the order)
_, return_index, return_inverse = np.unique(X,True,True)
@ -99,7 +99,7 @@ class StateSpace(Model):
(M, P) = self.kalman_filter(F,L,Qc,H,self.sigma2,Pinf,X.T,Y.T)
# Run the Rauch-Tung-Striebel smoother
if not filter:
if not filteronly:
(M, P) = self.rts_smoother(F,L,Qc,X.T,M,P)
# Put the data back in the original order