Skip to content

Dependent random variables #1

@rwkopcke

Description

@rwkopcke

In Chapter 16:

EDIT: I solved the problem below by deleting the following two lines from the code
with model:
start = mc.find_MAP()

and by editing the third line in the following block to remove the argument start=start from the call to mc.sample()
with model:
step = mc.Metropolis()
trace = mc.sample(100000, step=step)

Original Problem:
The code that appears here produces the following comment after mc.find_MAP()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymc3/tuning/starting.py:61: UserWarning: find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.
warnings.warn('find_MAP should not be used to initialize the NUTS sampler, simply call pymc3.sample() and it will automatically initialize NUTS in a better way.')
logp = -2.1562, ||grad|| = 1.6366: 100%|██████████| 8/8 [00:00<00:00, 1525.55it/s]

And the code that appears here produces a mean sigma of 0:
the command start prints
{'mean': array(3.),
'sigma_log__': array(-674.07720733),
'X': array(3.),
'sigma': array(1.78644019e-293)}

and the command trace.get_values('sigma').mean() produces
1.7864401850541627e-293

The code in the book, which is almost identical produces the same result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions