How could I fix the wrong message "Canceled future for execute_request message before replies were done" in pymc4

Viewed 1057

I am running my Bayesian model using pymc4.But It crushed when I do the sample metheod. I wanna know where my problem was. Here is my code

import pymc as pm
import numpy as np
import aesara.tensor as at
from aesara.compile.ops import as_op
assert pm.__version__ == '4.0.0b6'


data = [0.05 + i for i in np.random.uniform(-0.05, 0.2, 1000)]

##https://www.pymc.io/projects/docs/en/latest/learn/core_notebooks/pymc_overview.html?highlight=switch#case-study-2-coal-mining-disasters 
## example :Arbitary deterministics. I changed the function in the url above
@as_op(itypes=[at.dscalar, at.dscalar], otypes=[at.dscalar])
def piecewise_timespan_label(back, forward):
    td = forward - back
    if td >= 12:
        return 1
    elif td >= 8:
        return 0.9
    elif td >= 6:
        return 0.8
    elif td >= 4:
        return 0.6
    elif td >= 2:
        return 0.4
    elif td >= 1:
        return 0.2
    elif td >= 0.5:
        return 0.1
    elif td >= 0.05:
        return 0.08
    else:
        return 0.05


with pm.Model() as model_deterministic:
    back = pm.Exponential("back", 0.2)
    forward = pm.Exponential("forward", 0.2)
    ratio_est = piecewise_timespan_label(back, forward)
    eps = pm.HalfCauchy("eps", 0.5)
    y = pm.Normal("y", ratio_est, sigma=eps, observed=data)

with model_deterministic:
    idata = pm.sample(1000)

print('here')

Here is my wrong message:

Canceled future for execute_request message before replies were done
The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details.

My system is window 10 21H2 I am running it on vscode jupyter:v2022.4.1021342353

aesara:2.5.1

pymc:'4.0.0b6'

numpy:1.23.0rc1

Thank in advance for reply

0 Answers
Related