Skip to content

Commit

Permalink
fixed accept subroutine to take into account the memory length
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Dahlin committed Aug 19, 2015
1 parent 6126b4a commit 5f87300
Show file tree
Hide file tree
Showing 7 changed files with 9,809 additions and 9,800 deletions.
23 changes: 16 additions & 7 deletions para/pmh.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,22 @@ def acceptParameters(self,thSys,):
# Helper if parameters are rejected
##########################################################################
def rejectParameters(self,thSys,):
self.th[self.iter,:] = self.th[self.iter-1,:];
self.tho[self.iter,:] = self.tho[self.iter-1,:];
self.ll[self.iter] = self.ll[self.iter-1];
self.prior[self.iter,:] = self.prior[self.iter-1,:]
self.gradient[self.iter,:] = self.gradient[self.iter-1,:];
self.hessian[self.iter,:,:] = self.hessian[self.iter-1,:,:];
self.J[self.iter,:] = self.J[self.iter-1,:];
if ( ( self.PMHtype == "qPMH2" ) & ( self.iter > self.memoryLength ) ):
self.th[self.iter,:] = self.th[self.iter-1-self.memoryLength,:];
self.tho[self.iter,:] = self.tho[self.iter-1-self.memoryLength,:];
self.ll[self.iter] = self.ll[self.iter-1-self.memoryLength];
self.prior[self.iter,:] = self.prior[self.iter-1-self.memoryLength,:]
self.gradient[self.iter,:] = self.gradient[self.iter-1-self.memoryLength,:];
self.hessian[self.iter,:,:] = self.hessian[self.iter-1-self.memoryLength,:,:];
self.J[self.iter,:] = self.J[self.iter-1-self.memoryLength,:];
else:
self.th[self.iter,:] = self.th[self.iter-1,:];
self.tho[self.iter,:] = self.tho[self.iter-1,:];
self.ll[self.iter] = self.ll[self.iter-1];
self.prior[self.iter,:] = self.prior[self.iter-1,:]
self.gradient[self.iter,:] = self.gradient[self.iter-1,:];
self.hessian[self.iter,:,:] = self.hessian[self.iter-1,:,:];
self.J[self.iter,:] = self.J[self.iter-1,:];

##########################################################################
# Helper: compile the results and write to file
Expand Down
Binary file modified results/lgss-fapf-posteriors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9,788 changes: 4,894 additions & 4,894 deletions results/lgss-fapf-qpmh2.csv

Large diffs are not rendered by default.

Binary file modified results/lgss-fapf-trace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified results/lgss-kf-posteriors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9,798 changes: 4,899 additions & 4,899 deletions results/lgss-kf-qpmh2.csv

Large diffs are not rendered by default.

Binary file modified results/lgss-kf-trace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5f87300

Please sign in to comment.