Stan vs PYMC3 for Discrete Mixture ModelsDifficulties on pymc3 vs. pymc2 when discrete variables are involvedConditional prior in PyMC3How to benefit from GPU with PYMC3Incorrect inference with NUTS in pymc3Simple Hidden Markov Model Runs into Possible PyMC3 LimitationsMCMC convergence in hierarchical model with (large) time^2 term in pymc3How to evaluate the log-posterior in pymc3Use Chi-Squared statistic in pymc3Bayesian nonlinear regression with PyMC3How to model Mixture of Bernoullis in pymc3

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

What's the most polite way to tell a manager "shut up and let me work"?

How can I offer a test ride while selling a bike?

What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?

Bringing Food from Hometown for Out-of-Town Interview?

Can you please explain this joke: "I'm going bananas is what I tell my bananas before I leave the house"?

Did airlines fly their aircraft slower in response to oil prices in the 1970s?

Why use water tanks from a retired Space Shuttle?

Are there mythical creatures in the world of Game of Thrones?

How can I grammatically understand "Wir über uns"?

Singlequote and backslash

Is a hash a zero-knowledge proof?

How was Apollo supposed to rendezvous in the case of a lunar abort?

How to detach yourself from a character you're going to kill?

Why is there a need to modify system call tables in Linux?

Can you use a concentration spell while using Mantle of Majesty?

Why does my electric oven present the option of 40A and 50A breakers?

Is there any Biblical Basis for 400 years of silence between Old and New Testament?

Estimate related to the Möbius function

Beginner's snake game using PyGame

What people are called "кабан" and why?

Self-Preservation: How to DM NPCs that Love Living?

What damages does a hurting husband pay to his wife?

Are academic associations obliged to comply with the US government?



Stan vs PYMC3 for Discrete Mixture Models


Difficulties on pymc3 vs. pymc2 when discrete variables are involvedConditional prior in PyMC3How to benefit from GPU with PYMC3Incorrect inference with NUTS in pymc3Simple Hidden Markov Model Runs into Possible PyMC3 LimitationsMCMC convergence in hierarchical model with (large) time^2 term in pymc3How to evaluate the log-posterior in pymc3Use Chi-Squared statistic in pymc3Bayesian nonlinear regression with PyMC3How to model Mixture of Bernoullis in pymc3






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am studying zero-inflated count temporal data. I have built a stan model that deals with this zero-inflated data with an if statement in the model block. This is as they advise in the Stan Reference Guide. e.g.,



model 
for (n in 1:N) theta), bernoulli_lpmf(0



This if statement is clearly necessary as Stan uses NUTS as the sampler which does not deal with discrete variables (and thus we are marginalising over this discrete random variable instead of sampling from it). I have not had very much experience with pymc3 but my understanding is that it can deal with a Gibbs update step (to sample from the discrete bernoulli likelihood). Then conditioned on the zero-inflated value, it could perform a Metropolis or NUTS update for the parameters that depend on the Poisson likelihood.



My question is: Can (and if so how can) pymc3 be used in such a way to sample from the discrete zero-inflated variable with the updates to the continuous variable being performed with a NUTS update? If it can, is the performance significantly improved over the above implementation in stan (which marginalises out the discrete random variable)? Further, if pymc3 can only support a Gibbs + Metropolis update, is this change away from NUTS worth considering?










share|improve this question



















  • 2





    Yes, PyMC3 can block update continuous and discrete parameters to provide discrete sampling. The only problem is that it will be slower and less accurate and less robust. Marginalizing is almost always a win for efficiency/mixing due to the Rao-Blackwell theorem and for accuracy by working in expectation. This is explained with an example in the Stan user's guide chapter on latent discrete parameters (the change-point model is also available in PyMC3). So if you can marginalize in PyMC3 (or BUGS or JAGS), that'll be a big win for efficiency and accuracy.

    – Bob Carpenter
    Mar 25 at 15:28











  • Thanks very much Bob. I was not aware of the ties to Rao-Blackwell. I'll work though that to understand more.

    – nick
    Mar 26 at 8:15











  • Roughly speaking, the theorem says that working in expectation is more efficient. By marginalizing out the discrete parameters, you work in expectation.

    – Bob Carpenter
    Mar 27 at 17:28


















1















I am studying zero-inflated count temporal data. I have built a stan model that deals with this zero-inflated data with an if statement in the model block. This is as they advise in the Stan Reference Guide. e.g.,



model 
for (n in 1:N) theta), bernoulli_lpmf(0



This if statement is clearly necessary as Stan uses NUTS as the sampler which does not deal with discrete variables (and thus we are marginalising over this discrete random variable instead of sampling from it). I have not had very much experience with pymc3 but my understanding is that it can deal with a Gibbs update step (to sample from the discrete bernoulli likelihood). Then conditioned on the zero-inflated value, it could perform a Metropolis or NUTS update for the parameters that depend on the Poisson likelihood.



My question is: Can (and if so how can) pymc3 be used in such a way to sample from the discrete zero-inflated variable with the updates to the continuous variable being performed with a NUTS update? If it can, is the performance significantly improved over the above implementation in stan (which marginalises out the discrete random variable)? Further, if pymc3 can only support a Gibbs + Metropolis update, is this change away from NUTS worth considering?










share|improve this question



















  • 2





    Yes, PyMC3 can block update continuous and discrete parameters to provide discrete sampling. The only problem is that it will be slower and less accurate and less robust. Marginalizing is almost always a win for efficiency/mixing due to the Rao-Blackwell theorem and for accuracy by working in expectation. This is explained with an example in the Stan user's guide chapter on latent discrete parameters (the change-point model is also available in PyMC3). So if you can marginalize in PyMC3 (or BUGS or JAGS), that'll be a big win for efficiency and accuracy.

    – Bob Carpenter
    Mar 25 at 15:28











  • Thanks very much Bob. I was not aware of the ties to Rao-Blackwell. I'll work though that to understand more.

    – nick
    Mar 26 at 8:15











  • Roughly speaking, the theorem says that working in expectation is more efficient. By marginalizing out the discrete parameters, you work in expectation.

    – Bob Carpenter
    Mar 27 at 17:28














1












1








1








I am studying zero-inflated count temporal data. I have built a stan model that deals with this zero-inflated data with an if statement in the model block. This is as they advise in the Stan Reference Guide. e.g.,



model 
for (n in 1:N) theta), bernoulli_lpmf(0



This if statement is clearly necessary as Stan uses NUTS as the sampler which does not deal with discrete variables (and thus we are marginalising over this discrete random variable instead of sampling from it). I have not had very much experience with pymc3 but my understanding is that it can deal with a Gibbs update step (to sample from the discrete bernoulli likelihood). Then conditioned on the zero-inflated value, it could perform a Metropolis or NUTS update for the parameters that depend on the Poisson likelihood.



My question is: Can (and if so how can) pymc3 be used in such a way to sample from the discrete zero-inflated variable with the updates to the continuous variable being performed with a NUTS update? If it can, is the performance significantly improved over the above implementation in stan (which marginalises out the discrete random variable)? Further, if pymc3 can only support a Gibbs + Metropolis update, is this change away from NUTS worth considering?










share|improve this question
















I am studying zero-inflated count temporal data. I have built a stan model that deals with this zero-inflated data with an if statement in the model block. This is as they advise in the Stan Reference Guide. e.g.,



model 
for (n in 1:N) theta), bernoulli_lpmf(0



This if statement is clearly necessary as Stan uses NUTS as the sampler which does not deal with discrete variables (and thus we are marginalising over this discrete random variable instead of sampling from it). I have not had very much experience with pymc3 but my understanding is that it can deal with a Gibbs update step (to sample from the discrete bernoulli likelihood). Then conditioned on the zero-inflated value, it could perform a Metropolis or NUTS update for the parameters that depend on the Poisson likelihood.



My question is: Can (and if so how can) pymc3 be used in such a way to sample from the discrete zero-inflated variable with the updates to the continuous variable being performed with a NUTS update? If it can, is the performance significantly improved over the above implementation in stan (which marginalises out the discrete random variable)? Further, if pymc3 can only support a Gibbs + Metropolis update, is this change away from NUTS worth considering?







bayesian pymc3 mcmc stan pystan






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 13:04







nick

















asked Mar 24 at 10:47









nicknick

629313




629313







  • 2





    Yes, PyMC3 can block update continuous and discrete parameters to provide discrete sampling. The only problem is that it will be slower and less accurate and less robust. Marginalizing is almost always a win for efficiency/mixing due to the Rao-Blackwell theorem and for accuracy by working in expectation. This is explained with an example in the Stan user's guide chapter on latent discrete parameters (the change-point model is also available in PyMC3). So if you can marginalize in PyMC3 (or BUGS or JAGS), that'll be a big win for efficiency and accuracy.

    – Bob Carpenter
    Mar 25 at 15:28











  • Thanks very much Bob. I was not aware of the ties to Rao-Blackwell. I'll work though that to understand more.

    – nick
    Mar 26 at 8:15











  • Roughly speaking, the theorem says that working in expectation is more efficient. By marginalizing out the discrete parameters, you work in expectation.

    – Bob Carpenter
    Mar 27 at 17:28













  • 2





    Yes, PyMC3 can block update continuous and discrete parameters to provide discrete sampling. The only problem is that it will be slower and less accurate and less robust. Marginalizing is almost always a win for efficiency/mixing due to the Rao-Blackwell theorem and for accuracy by working in expectation. This is explained with an example in the Stan user's guide chapter on latent discrete parameters (the change-point model is also available in PyMC3). So if you can marginalize in PyMC3 (or BUGS or JAGS), that'll be a big win for efficiency and accuracy.

    – Bob Carpenter
    Mar 25 at 15:28











  • Thanks very much Bob. I was not aware of the ties to Rao-Blackwell. I'll work though that to understand more.

    – nick
    Mar 26 at 8:15











  • Roughly speaking, the theorem says that working in expectation is more efficient. By marginalizing out the discrete parameters, you work in expectation.

    – Bob Carpenter
    Mar 27 at 17:28








2




2





Yes, PyMC3 can block update continuous and discrete parameters to provide discrete sampling. The only problem is that it will be slower and less accurate and less robust. Marginalizing is almost always a win for efficiency/mixing due to the Rao-Blackwell theorem and for accuracy by working in expectation. This is explained with an example in the Stan user's guide chapter on latent discrete parameters (the change-point model is also available in PyMC3). So if you can marginalize in PyMC3 (or BUGS or JAGS), that'll be a big win for efficiency and accuracy.

– Bob Carpenter
Mar 25 at 15:28





Yes, PyMC3 can block update continuous and discrete parameters to provide discrete sampling. The only problem is that it will be slower and less accurate and less robust. Marginalizing is almost always a win for efficiency/mixing due to the Rao-Blackwell theorem and for accuracy by working in expectation. This is explained with an example in the Stan user's guide chapter on latent discrete parameters (the change-point model is also available in PyMC3). So if you can marginalize in PyMC3 (or BUGS or JAGS), that'll be a big win for efficiency and accuracy.

– Bob Carpenter
Mar 25 at 15:28













Thanks very much Bob. I was not aware of the ties to Rao-Blackwell. I'll work though that to understand more.

– nick
Mar 26 at 8:15





Thanks very much Bob. I was not aware of the ties to Rao-Blackwell. I'll work though that to understand more.

– nick
Mar 26 at 8:15













Roughly speaking, the theorem says that working in expectation is more efficient. By marginalizing out the discrete parameters, you work in expectation.

– Bob Carpenter
Mar 27 at 17:28






Roughly speaking, the theorem says that working in expectation is more efficient. By marginalizing out the discrete parameters, you work in expectation.

– Bob Carpenter
Mar 27 at 17:28













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55322997%2fstan-vs-pymc3-for-discrete-mixture-models%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55322997%2fstan-vs-pymc3-for-discrete-mixture-models%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현