Bayesian, stan and python

in #blog8 months ago

I have been playing arround with pystan today which is the interface for stan, a language for statistical models. It allows for relatively easy implementation of Bayesian inference for data analysis. More specifically, you suppose that a process in the real world is described by probabilities and based on that you formulate a model. You don't know the parameters of that model. However, you do have some data. Bayesian inference lets you put the data and model together to define a "new model" which is in some kind of way connected to the data.

Numerically, solving this problem is very hard. It relies on brute force a.k.a Monte carlo :P It can be quite complicated to develop efficient algorihms for this. But pystan has some smart algorithms built in it so that solves a lot when you a starting out with these type of problems.

Here is a nice short course on Bayesian inference for peeps with experience in R or python ->

with some exercises
Note the pystan stuff is a bit outdated you need to split pystan.stan in

model = pystan.StanModel(model_code = model_string)
fit = model.sampling(data=data_list)

Neat. Now i will need to find an example that needs a Bayes and try it out

There are some fishy examples in the exercises of the lecture :P

This post has been voted on by the SteemSTEM curation team and voting trail. It is elligible for support from @curie and @minnowbooster.

If you appreciate the work we are doing, then consider supporting our witness @stem.witness. Additional witness support to the curie witness would be appreciated as well.

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

Please consider using the app and/or including @steemstem in the list of beneficiaries of this post. This could yield a stronger support from SteemSTEM.

Thanks for sharing this valuable information!

I currently also practicing things like this.

Very helpful.


Hi @mathowl!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 3.871 which ranks you at #4769 across all Steem accounts.
Your rank has improved 20 places in the last three days (old rank 4789).

In our last Algorithmic Curation Round, consisting of 85 contributions, your post is ranked at #47.

Evaluation of your UA score:
  • You're on the right track, try to gather more followers.
  • The readers like your work!
  • Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!

Feel free to join our @steem-ua Discord server