-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix AR(1) log likelihood #2285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix AR(1) log likelihood #2285
Changes from 1 commit
1887b7a
d7a1bc1
e310bfc
7a7818d
24aa987
d6c6155
989f395
28f83bb
655c5df
ec71e82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| NegativeBinomial, Geometric, Exponential, ExGaussian, Normal, | ||
| Flat, LKJCorr, Wald, ChiSquared, HalfNormal, DiscreteUniform, | ||
| Bound, Uniform, Triangular, Binomial, SkewNormal, DiscreteWeibull, Gumbel, | ||
| Interpolated, ZeroInflatedBinomial) | ||
| Interpolated, ZeroInflatedBinomial, AR1) | ||
| from ..distributions import continuous | ||
| from pymc3.theanof import floatX | ||
| from numpy import array, inf, log, exp | ||
|
|
@@ -284,6 +284,10 @@ def mvt_logpdf(value, nu, Sigma, mu=0): | |
| return log_pdf | ||
|
|
||
|
|
||
| def AR1_logpdf(value, k, tau_e): | ||
| return (sp.norm(loc=0,scale=1/np.sqrt(tau_e)).logpdf(value[0]) + | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pep8 wants spaces around math operators.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But yeah, this test is a bit odd as it basically repcliates the likelihood.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think we should use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| sp.norm(loc=k*value[:-1],scale=1/np.sqrt(tau_e)).logpdf(value[1:]).sum()) | ||
|
|
||
| class Simplex(object): | ||
| def __init__(self, n): | ||
| self.vals = list(simplex_values(n)) | ||
|
|
@@ -676,6 +680,11 @@ def test_mvt(self, n): | |
| {'nu': Rplus, 'Sigma': PdMatrix(n), 'mu': Vector(R, n)}, | ||
| mvt_logpdf) | ||
|
|
||
| @pytest.mark.parametrize('n',[2,3,4]) | ||
| def test_AR1(self, n): | ||
| self.pymc3_matches_scipy(AR1, Vector(R, n), {'k': Unit, 'tau_e': Rplus}, AR1_logpdf) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize('n', [2, 3]) | ||
| def test_wishart(self, n): | ||
| # This check compares the autodiff gradient to the numdiff gradient. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this looks like a bug to me.