question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

abc.run stuck at t=1 for integer parameters

See original GitHub issue

Hi, so if for models with integer parameters the abc.run gets stuck at t=1 without running the model. Weirdly, there is no error message or crush. Maybe there is an issue with the transition kernel for integer parameters. The problem can be circumvented by using a float parameter that gets rounded to the next integer, however, it still consider the current behavior a bug. Here’s a MWE:

import pyabc
from pyabc.sampler import SingleCoreSampler
import numpy as np
import tempfile
import os
import matplotlib.pyplot as plt

def model(par):
    # print('new run!')
    return {"data": np.random.binomial(par['n'], 0.5)}

def distance(x, y):
    return abs(x["data"] - y["data"])

prior = pyabc.Distribution(n=pyabc.RV("randint", 1, 21))  # it works if I switch to 'uniform'
abc = pyabc.ABCSMC(model, prior, distance, sampler=SingleCoreSampler())  # SingleCoreSampler because I am on Windows

db_path = ("sqlite:///" +
           os.path.join(tempfile.gettempdir(), "test.db"))
observation = 5
abc.new(db_path, {"data": observation})
history = abc.run(minimum_epsilon=0., max_nr_populations=10)


fig, ax = plt.subplots()
for t in range(1, history.max_t+1, 2):
    df, w = history.get_distribution(m=0, t=t)
    pyabc.visualization.plot_kde_1d(
        df, w,
        xmin=0, xmax=20,
        x="n", ax=ax,
        label="PDF t={}".format(t))
plt.legend()
plt.show()

I am on Windows 10x64 with the latest Anaconda environment, where I installed pyabc via pypi. My pyabc version is 0.10.4.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sisygacommented, Jul 30, 2020

Thank you @yannikschaelte , that sounds very promising, I will contact you via email about it!

0reactions
yannikschaeltecommented, Aug 1, 2020

warning added in #331

Read more comments on GitHub >

github_iconTop Results From Across the Web

Int) with actual type `(t0, t1, t2) - haskell - Stack Overflow
I got stuck in this program. It takes three numbers and puts them in ascending order. Can anyone help me and tell me...
Read more >
Update statement - Ask TOM
Hi Tom 1. I have an Update statement which is taking too long. It has a co-related subquery. How can I optimize it...
Read more >
Find the Cause of a UI Freeze | dotTrace Documentation
In Profiling type, select Timeline. T1 profiling options. Click Run. dotTrace will run our application and display a special controller window ...
Read more >
PandaAthena < PanDA < TWiki
(integer N>0); I want to run a transformation like Reco_tf.py with N events per job. I want to launch M jobs, each with...
Read more >
Advanced Bash-Scripting Guide
Within a script, an exit nnn command may be used to deliver an nnn exit status to the shell (nnn must be an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found