https://github.com/pymc-devs/pymc3
Tip revision: 081e7f4a55ce45ef50a03f8062611051d9c00ce8 authored by Thomas Wiecki on 20 December 2018, 18:01:59 UTC
Add date to release notes and note on dropping python 2 support.
Add date to release notes and note on dropping python 2 support.
Tip revision: 081e7f4
factor_potential.py
import pymc3 as pm
"""
You can add an arbitrary factor potential to the model likelihood using
pm.Potential. For example you can added Jacobian Adjustment using pm.Potential
when you do model reparameterization. It's similar to `increment_log_prob` in
STAN.
"""
def build_model():
with pm.Model() as model:
x = pm.Normal('x', 1, 1)
x2 = pm.Potential('x2', -x ** 2)
return model
def run(n=1000):
model = build_model()
if n == "short":
n = 50
with model:
pm.sample(n)
if __name__ == '__main__':
run()