Skip to content

Commit 014b601

Browse files
committed
Update timeseries
1 parent eb71978 commit 014b601

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

pymc/tests/test_distributions_timeseries.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,16 @@ def check_not_implemented(self):
6969
with pytest.raises(NotImplementedError):
7070
self.pymc_rv.eval()
7171

72+
# TODO: Move this out of this test class, not related, makes more sense together with
73+
# the other logp tests
7274
def test_grw_inference(self):
7375
mu, sigma, steps = 2, 1, 10000
7476
obs = np.concatenate([[0], np.random.normal(mu, sigma, size=steps)]).cumsum()
7577

7678
with pm.Model():
7779
_mu = pm.Uniform("mu", -10, 10)
7880
_sigma = pm.Uniform("sigma", 0, 10)
79-
# Workaround for bug in `at.diff` when data is constant
81+
8082
obs_data = pm.MutableData("obs_data", obs)
8183
grw = GaussianRandomWalk("grw", _mu, _sigma, steps=steps, observed=obs_data)
8284

@@ -90,19 +92,18 @@ def test_grw_inference(self):
9092
class TestGRWScipy(td.TestMatchesScipy):
9193
# TODO: Test LogP for different inits in its own function
9294

93-
# TODO: Find issue that says GRW wont take vector
95+
# TODO: Find issue that says GRW wont take vector
9496
def test_grw_logp(self):
9597
def grw_logp(value, mu, sigma):
9698
# Relying on fact that init will be normal
97-
# Note: This means we're not testing
99+
# Note: This means we're not testing
98100
stationary_series = np.diff(value)
99-
logp = (
100-
stats.norm.logpdf(value[0], mu, sigma)
101-
+ stats.norm.logpdf(stationary_series, mu, sigma).sum(),
102-
)
101+
logp = stats.norm.logpdf(value[0], mu, sigma) + \
102+
stats.norm.logpdf(stationary_series, mu, sigma).sum(),
103103
return logp
104-
104+
105105
# TODO: Make base class a static method
106+
# TODO: Reuse this make this static so it doesnt run all other ones
106107
self.check_logp(
107108
pm.GaussianRandomWalk,
108109
td.Vector(td.R, 10),

0 commit comments

Comments
 (0)