Skip to content

Commit

Permalink
set the minimum value of the NormalNoiseModel variance
Browse files Browse the repository at this point in the history
  • Loading branch information
SamWitty committed Apr 16, 2024
1 parent 366e755 commit f1eded0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyciemss/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import torch


EPS = 1e-7

class NoiseModel(pyro.nn.PyroModule):
"""
An NoiseModel is a function that takes a state and returns a state sampled from some pyro distribution.
Expand Down Expand Up @@ -60,4 +62,5 @@ def __init__(
def markov_kernel(
self, name: str, val: torch.Tensor
) -> pyro.distributions.Distribution:
return pyro.distributions.Normal(val, self.scale * torch.abs(val)).to_event(1)
var = torch.minimum(self.scale * torch.abs(val), EPS)
return pyro.distributions.Normal(val, var).to_event(1)

0 comments on commit f1eded0

Please sign in to comment.