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.

Discrete Variables in emcee

See original GitHub issue

Hi,

First of all: Thanks for all the great work put into emcee!

I was wondering whether it would be possible to sample discrete variables with emcee. I have created a small example script that estimates the number of trials and probability of success for a binomial distribution here https://gist.github.com/lfloeer/d8a2d3ccc8898eeb02af

I achieve the discrete sampling by simply casting the parameter to int when calculating the likelihood. The results do look sensible, but I am unsure whether I’m introducing a bias of some sort. I imagine that rounding off a variable prior to likelihood computation is equivalent of having a stepwise likelihood and I can’t see anything wrong with that (apart from it not being continuously differentiable which makes optimization difficult/impossible).

My ultimate goal would be to perform model selection as described by @fonnesbeck in http://stronginference.com/bayes-factors-pymc.html

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dfmcommented, Apr 28, 2020

@yoavram: That’s right, but that will change what your bounds mean. For example, if you want a binary variable, you should set the bounds as -0.5 < theta < 1.5 whereas, if you’re flooring, you should use 0 < theta < 2. This doesn’t matter so much for binary, but if you have more classes, it’ll matter more!

0reactions
yoavramcommented, Apr 28, 2020

Hi @dfm, quick question – there’s no advantage to rounding vs flooring the value, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Latent Discrete Parameters | Stan User's Guide
This chapter shows how to code several widely-used models involving latent discrete parameters. The next chapter, the clustering chapter, on clustering models, ...
Read more >
Discrete vs. Continuous Data - TrustRadius for Vendors
Discrete data refers to countable, individualized items. These items are not divisible. Instead, they only exist in set increments or units.
Read more >
Continuous vs Discrete Variables in the context of Machine ...
A Discrete variable can take only a specific value amongst the set of all possible values or in other words, if you don't...
Read more >
Marginal likelihood for distributions with discrete variables - v3
Therefore, I'm wondering for my case with both discrete and continuous variables, as well as a weight variable which needs to be between...
Read more >
Chapter 3. Discrete Random Variables 3.1
Below are some descriptions of random variables. Find their ranges and classify them as a discrete random variable (DRV) or continuous random variable...
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