Skip to content

Commit

Permalink
changed std dev calculation for discrepancy surrogate type in train f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
kylajones committed Jul 29, 2024
1 parent 8cabd11 commit 437b9b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions linfa/run_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,10 @@ def train(self, nf, optimizer, iteration, log, sampling=True, t=1):
else:
np.savetxt(self.output_dir + '/' + self.name + '_outputs_' + str(iteration), (self.model.solve_t(self.transform.forward(xkk)) + noise).data.cpu().numpy(), newline="\n")
elif(self.surrogate_type == 'discrepancy'):
# TODO: this is no longer correct?
# Define noise when we use NoFAS
stds = torch.abs(self.model.defOut).to(self.device) * self.model.stdRatio
# TODO confirm the following changes with DS
## Define noise when we use NoFAS
# stds = torch.abs(self.model.defOut).to(self.device) * self.model.stdRatio
stds = torch.mean(torch.abs(self.model.defOut)).to(self.device) * self.model.stdRatio
# Noise is rows: number of T,P pairs, columns: number of batches
o00 = torch.randn(self.model.data.shape[0], x00.size(0)).to(self.device)
noise = o00*stds.repeat(1,x00.size(0))
Expand Down

0 comments on commit 437b9b8

Please sign in to comment.