Skip to content

Instantly share code, notes, and snippets.

@ckrapu
Created July 14, 2020 13:44
Show Gist options
  • Save ckrapu/7a3f6cbd834b21cc48b0259027a5aa65 to your computer and use it in GitHub Desktop.
Save ckrapu/7a3f6cbd834b21cc48b0259027a5aa65 to your computer and use it in GitHub Desktop.
import theano
import theano.tensor as tt
import numpy as np
import pymc3 as pm
print(theano.__version__)
x = np.asarray([0,1])
print(x.dtype)
import numpy as np
test_values = np.arange(32752, 32772, 1);
for v in test_values:
model = pm.Model();
with model:
mu = pm.Normal("mu", mu=0, sd=10);
Y = pm.NegativeBinomial("Y", mu=2**mu, alpha=10, observed=v)
Z = pm.Poisson('Z', mu=2**mu, observed=v)
for RV in model.basic_RVs:
if RV.name in ["Y","Z"]:
print(v, RV.logp(model.test_point));
print(tt.as_tensor_variable(test_values).dtype)
factln = pm.distributions.dist_math.factln
n = 32768 + 10
k = 32768
for val in [factln(n), factln(k), factln(n - k)]:
print(val.eval())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment