markdregan/Bayesian-Modelling-in-Python

Section 2 fails when trying to sample the model

elypma opened this issue · 4 comments

I am using pymc3 version 3.0 together with anaconda 4.0.0 & python 2.7 and theano 0.8.2.
In the section 2 notebook:

with pm.Model() as model:
    mu = pm.Uniform('mu', lower=0, upper=100)
    y_est = pm.Poisson('y_est', mu=mu, observed=messages['time_delay_seconds'].values)

    y_pred = pm.Poisson('y_pred', mu=mu)

    start = pm.find_MAP()
    step = pm.Metropolis()
    trace = pm.sample(50000, step, start=start, progressbar=True)

Leaving out the y_ptred = ... statement removes the crash but also removes the purpose of the example...

Since I'm trying to learn pymc3 I currently have no idea where to start.
Something goes wrong in theano (strack-trace):

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-76dad9c91fda> in <module>()
      7     start = pm.find_MAP()
      8     step = pm.Metropolis()
----> 9     trace = pm.sample(50000, step, start=start, progressbar=True)

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\pymc3\sampling.pyc in sample(draws, step, start, trace, chain, njobs, tune, progressbar, model, random_seed)
    148         sample_func = _sample
    149 
--> 150     return sample_func(**sample_args)
    151 
    152 

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\pymc3\sampling.pyc in _sample(draws, step, start, trace, chain, tune, progressbar, model, random_seed)
    157     progress = progress_bar(draws)
    158     try:
--> 159         for i, strace in enumerate(sampling):
    160             if progressbar:
    161                 progress.update(i)

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\pymc3\sampling.pyc in _iter_sample(draws, step, start, trace, chain, tune, model, random_seed)
    239         if i == tune:
    240             step = stop_tuning(step)
--> 241         point = step.step(point)
    242         strace.record(point)
    243         yield strace

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\pymc3\step_methods\compound.pyc in step(self, point)
     12     def step(self, point):
     13         for method in self.methods:
---> 14             point = method.step(point)
     15         return point

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\pymc3\step_methods\arraystep.pyc in step(self, point)
    116         bij = DictToArrayBijection(self.ordering, point)
    117 
--> 118         apoint = self.astep(bij.map(point))
    119         return bij.rmap(apoint)
    120 

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\pymc3\step_methods\metropolis.pyc in astep(self, q0)
    123             q = q0 + delta
    124 
--> 125         q_new = metrop_select(self.delta_logp(q, q0), q, q0)
    126 
    127         if q_new is q:

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\theano\compile\function_module.pyc in __call__(self, *args, **kwargs)
    869                     node=self.fn.nodes[self.fn.position_of_error],
    870                     thunk=thunk,
--> 871                     storage_map=getattr(self.fn, 'storage_map', None))
    872             else:
    873                 # old-style linkers raise their own exceptions

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\theano\gof\link.pyc in raise_with_op(node, thunk, exc_info, storage_map)
    312         # extra long error message in that case.
    313         pass
--> 314     reraise(exc_type, exc_value, exc_trace)
    315 
    316 

C:\Users\egbert\AppData\Local\Continuum\Anaconda\py27_64\lib\site-packages\theano\compile\function_module.pyc in __call__(self, *args, **kwargs)
    857         t0_fn = time.time()
    858         try:
--> 859             outputs = self.fn()
    860         except Exception:
    861             if hasattr(self.fn, 'position_of_error'):

Can you update pymc3 to master? I run the model successfully with theano 0.8.2.

@elypma - were you able to rerun with updated pymc3?

I still have to try
On 8 Jun 2016 20:50, "Mark Regan" notifications@github.com wrote:

@elypma https://github.com/elypma - were you able to rerun with updated
pymc3?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ACEUiRYTLQabysGcb7NppZitVPpmwWNwks5qJw8KgaJpZM4Igrnr
.

Unable to replicate. Closing for now. Let me know if you still experience the issue.