Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi when ever I tried running NUTS sampling my notebook gets disconnected from kernel. #3078

Closed
priyalchaudhari opened this issue Jul 6, 2018 · 3 comments

Comments

@priyalchaudhari
Copy link

priyalchaudhari commented Jul 6, 2018

If you have questions about a specific use case, please post it to our discourse channel: https://discourse.pymc.io
If you are not sure whether this is a bug or not, please also post it on discourse.

Description of your problem

Please provide a minimal, self-contained, and reproducible example.

Please provide the full traceback.

Please provide any additional information below.
Hi I am Trying to run below code:
This code perfectly working on 8gb ram and i7 processor laptop (it was slow but it worked)
Now I am trying to run this code on my new laptop with same installation of anaconda and jupyter notebook. laptop config is 16gb ram and i7 processor . But this time my notebook gets disconnected from kernel.

Here is my code:

`g1 = df.groupby('i_away')
att_starting_points = np.log(g1['away_team/goals'].fillna(0).mean())
g2 = df.groupby('i_home')
def_starting_points = -np.log(g2['home_team/goals'].fillna(0).mean())
def_starting_points

with pm.Model() as model:
# global model priors: standard deviation and intercept
home = pm.Flat('home') #flat pdf is uninformative - means we have no idea
sd_att = pm.HalfStudentT('sd_att', nu=3, sd=2.5)
sd_def = pm.HalfStudentT('sd_def', nu=3, sd=2.5)
intercept = pm.Flat('intercept')

# team-specific model parameters
atts_star = pm.Normal("atts_star", mu=0, sd=sd_att, shape=num_teams)
defs_star = pm.Normal("defs_star", mu=0, sd=sd_def, shape=num_teams)

# To allow samples of expressions to be saved, we need to wrap them in pymc3 Deterministic objects
atts = pm.Deterministic('atts', atts_star - tt.mean(atts_star))
defs = pm.Deterministic('defs', defs_star - tt.mean(defs_star))

# Assume exponential search on home_theta and away_theta. With pymc3, need to rely on theano.
# tt is theano.tensor.. why Sampyl may be easier to use..
home_theta = tt.exp(intercept + home + atts[home_team] + defs[away_team])  
away_theta = tt.exp(intercept + atts[away_team] + defs[home_team])

# likelihood of observed data
home_points = pm.Poisson('home_points', mu=home_theta, observed=observed_home_goals)
away_points = pm.Poisson('away_points', mu=away_theta, observed=observed_away_goals)

with model:
trace = pm.sample(1000, tune=1000, cores=2)
pm.traceplot(trace)`

Even if I do 10 samples it will still crash.

Versions and main components

  • PyMC3 Version: PyMC3 v3.4.1

  • Theano Version:

    pygpu: 0.7.6-py36_0 mila-udem
    pymc3: 3.4.1-py36_0
    theano: 1.0.2-py36_0 mila-udem

  • Python Version: python 3.6

  • Operating system: windows 10

  • How did you install PyMC3: (conda/pip): conda
    conda install pymc3

capture

capture1

These are screen shots from notebook

@junpenglao
Copy link
Member

Could you please upgrade to master branch and try again - this might be fixed already.

@priyalchaudhari
Copy link
Author

priyalchaudhari commented Jul 6, 2018

  • Hi i tried the core 1 solution it dosent work. I will try to upgrade to master branch .
    how can i upgrade to master using conda

will this upgrade it to maste
conda install -c conda-forge pymc3

Update:
I ran above command it didnt fixed the isuue I am still facing same problem.
Please advice on how to upgrade to master.
This error occurs within 5 secs

@priyalchaudhari
Copy link
Author

ThanK you so much . Upgrading to master branch solved the isuue.
this is how you can do it:

pip3 install git+https://github.com/pymc-devs/pymc3@master

thank you @junpenglao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants