r/BayesianProgramming • • Sep 25 '17

A Library for Bayesian Deep Learning

Thumbnail
arxiv.org
3 Upvotes

r/BayesianProgramming • • Aug 14 '17

Intro to Probabilistic Programming and Clojure’s Anglican - Nils Blum-Oeste

Thumbnail
youtube.com
3 Upvotes

r/BayesianProgramming • • Jul 24 '17

Maxwell W Libbrecht - pomegranate: fast and flexible probabilistic modeling in python

Thumbnail
youtube.com
3 Upvotes

r/BayesianProgramming • • Jul 24 '17

Book Note: Introduction to Hierarchical Bayesian Modeling for Ecological Data, Chapter 1

Thumbnail
mythicalprogrammer.github.io
3 Upvotes

r/BayesianProgramming • • Jun 28 '17

Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity - NYC Algorithmic Trading (New York, NY)

Thumbnail
meetup.com
3 Upvotes

r/BayesianProgramming • • Jun 24 '17

Jonathan Sedar - Hierarchical Bayesian Modelling with PyMC3 and PySTAN

Thumbnail
youtube.com
3 Upvotes

r/BayesianProgramming • • Jun 22 '17

Christopher Fonnesbeck - Introduction to Statistical Modeling with Python - PyCon 2017

Thumbnail
youtube.com
3 Upvotes

r/BayesianProgramming • • Jun 22 '17

Prerequisites for PPL or Bayesian ML/DL/RL

3 Upvotes

Hi, I'm a student with a theoretical probability background and knows python.

In terms of statistics, what additional material would I need to know

Can I just jump into PPL w/o a ML or Algo background? What else do I need

Thanks


r/BayesianProgramming • • Jun 20 '17

Christopher Fonnesbeck Probabilistic Programming with PyMC3 PyCon 2017

Thumbnail
youtube.com
3 Upvotes

r/BayesianProgramming • • Jun 20 '17

Model-Based Machine Learning (Early Access): an online book

Thumbnail
mbmlbook.com
3 Upvotes

r/BayesianProgramming • • May 29 '17

Introduction To Probabilistic Modeling and Machine Learning

Thumbnail
youtube.com
3 Upvotes

r/BayesianProgramming • • Feb 19 '25

Optimization algorithm with deterministic objective value

2 Upvotes

I have an optimization problem with around 10 parameters, each with known bounds. Evaluating the objective function is expensive, so I need an algorithm that can converge within approximately 100 evaluations. The function is deterministic (same input always gives the same output) and is treated as a black box, meaning I don't have a mathematical expression for it.

I considered Bayesian Optimization, but it's often used for stochastic or noisy functions. Perhaps a noise-free Gaussian Process variant could work, but I'm unsure if it would be the best approach.

Do you have any suggestions for alternative methods, or insights on whether Bayesian Optimization would be effective in this case?
(I will use python)


r/BayesianProgramming • • Oct 10 '24

OSX user - given up on PYMC

2 Upvotes

As the title suggests, I’ve given up trying to get my python conda environment working with PYMC on osx.

I feel like I’ve tried everything from every thread.

Either the import of the package gets stuck on BLAS or, when I overcome the BLAS Hangup, the kernel dies immediately when I run the simplest of models.

I’ve tried using it in terminal, anadonda, and VSCODE and it’s the same hassle.

Am I the only one?

I’m going back to PYMC3


r/BayesianProgramming • • May 02 '24

What would cause such large discrepancies in an MCMC convergence, ceteris paribus?

2 Upvotes

I am quite sick this week so haven't had a chance to actually go through it, plus the MCMC is still running for the other colours. I am also a first-year postgraduate student who only learned 2 years ago I love Bayesian, so I am a right newbie at this.

Quick background: The colours represent mice. All mice have a maximum of 32 data points. One is missing one observation and another is missing two (which is the orange mouse). The black one being named incorrectly is from a previous run, but is expected to output the same this run (I just named it wrong). The black one has 32 observations. I am running 4 treatments - the control, ad, adpeg, and adpegher. The black listed here is actually adpegher, not adpeg. There's 4 mice in control but 6 mice in all the modified treatments, though that's not really important here.

The question:

EVERYTHING is the same except for the values and the 30-32 data point thing.

But these have HUGE discrepancies in size. Would this be PURELY from the MCMC having different convergence rates, or could it be the trace lengths, or autocorrelation? There was some drama with autocorrelation between two parameters (there's 8 parameters) in the ad data, would that be a possibility with the orange mouse in adpegher?

I know I should just wait for it to finish and then check the traceplots etc, but I am curious as I have another 20ish hours of waiting and wanted to test the things I thought it could be first thing (for fun) so I could crack it early. I'd like some suggestions on what could cause this discrepancy in size (seriously 10k kb vs 239k kb??) so I can muck about with it when all 6 mice are done?

I know I could just do it with the four mice here (but I do want to wait for the new black to finish too, just in case my convergence went funny when I mucked up the code on the previous job) but I really just wanted to get folks ideas and thoughts on why this would be BEFORE I do that, just so I can see what I am looking for. The Bayesian approach to Bayesian, you could say. Come on folks, gimme some prior beliefs! Please and thank you :).


r/BayesianProgramming • • Mar 27 '24

Bootstrapping means instead of dealing with complex distribution

2 Upvotes

Hello everyone! I'm learning how to apply bayesian inference for ab testing. We have 2 randomized groups of users (control /test) and trying to find out differences in average revenue per user (arpu) between groups.

Most of users are non paying, so in both groups there are a lot of users with $0 revenue and only small part of users purchase something (1-5%). Paying users distribution is highly skewed, there are small fraction of users who pay a lot, but most pay not too much. My first idea was to multiply bernoulli by something that fit payers (like gamma distribution) but it seems to really hard to find sometihg with a good fit, so i got nowhere.

Another approach which came to mind: bootstrap users and find average revenue per user for each bootstrapped sample. That resulted in almost normally distributed means for bootstrapped samples (CLT seems to be working for that case). Now my idea is to pass these means as observations into likelyhood function as normally distributed; to define priors for both groups i plan to use historical data and in a similar way bootstrap it to find out mean and sd, which will be used as parameters for normally distributed means and halfnormally distributed sd's.

This looks like that:

Priors:

mean_a = N(<bootstrapped_historical_mean>,<bootstrapped_historical_sd_of_sample_means>)

mean_b = N(<bootstrapped_historical_mean>,<bootstrapped_historical_sd_of_sample_means>)

std_a = HN(<bootstrapped_historical_sd_of_samples>)

std_a = HN(<bootstrapped_historical_sd_of_samples>)

Likelyhood:

group_a = N(<mean_a>,<std_a>, observations: <bootstrapped_means_A>)

group_b = N(<mean_a>,<std_a>, observations: <bootstrapped_means_B>)

Is that looks like a valid approach or i'm missing/violating something? The main question is a difference in average revenue per user between groups.


r/BayesianProgramming • • Mar 21 '24

Need Numpyro modeling help

2 Upvotes

Hi all,

I've been building a Bayesian model using the numpyro library and I've hit a modeling issue I can't get around at the moment. I need to draw samples of shape (3, ) from a uniform distribution and I also need them ordered in an increasing order. I tried to just order them *after* sampling, but that creates degeneracies between the parameters that makes sampling very difficult because the parameters are always swapping each other which results in an improper burn in. Does anybody know how to add this constraint so that the samples that get generated are always in order without creating a degeneracy?

Hope my question makes sense. Thanks for the help!!!


r/BayesianProgramming • • Aug 15 '23

New Bayesian, CANNOT install R package, 'BayesFactor' and dependencies w/'gfortran' compiler

2 Upvotes

My ultimate goal is to install the package, BayesFactor. To install it and its dependencies required 'gfortran' to compile when necessary. I have MacOS and am trying to set the 'gfortran' path in R. I verified that the location of gfortran is "/usr/local/bin/gfortran". However, the following code does not seem to work to install any dependencies including 'deSolve' (see code and output attached below). Is this error occuring because R cannot find the compiler, 'gfortran'? If so, what should I do instead?

> Sys.setenv(PATH = paste("/usr/local/bin/gfortran", Sys.getenv("PATH"), sep = ":"))

> install.packages("~/Downloads/deSolve_1.36 (1).tar.gz", repos = NULL, type = "source")

* installing *source* package ‘deSolve’ ...

** package ‘deSolve’ successfully unpacked and MD5 sums checked

** using staged installation

** libs

... (too long to include)

make: /opt/R/arm64/bin/gfortran: No such file or directory

make: *** [daux.o] Error 1

ERROR: compilation failed for package ‘deSolve’

* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/deSolve’

Warning in install.packages :

installation of package ‘/Users/AsuS/Downloads/deSolve_1.36 (1).tar.gz’ had non-zero exit status


r/BayesianProgramming • • Nov 01 '22

neff and bulk

2 Upvotes

hello all, i work in a STAN code and stan give me lower values of neff and bulk, how can i get higher values of neff and bulk? thanks in advice

my stan code

 data {
   int<lower=1> N; // number of records
   int<lower=1> NEQ; // number of earthquakes
   int<lower=1> NSTAT; // number of stations

   vector[N] M; // magnitudes
   vector[N] R; // distances
   vector[N] VS; // Vs30 values
   
   vector[N] Y;       // log EAS 
   
   int<lower=1,upper=NEQ> idx_eq[N];
   int<lower=1,upper=NSTAT+1> idx_st[N];
 }


 parameters {
   real c1;
   real c2;
   real c3;
   real cn;
   real cN;
   real cM;
   real c4;
   real c5;
   real c6;
   real chm;
   real c7;
   real c8;

   real<lower=0> phiSS;
   real<lower=0> tau;
   real<lower=0> phiS2S;

   vector[NEQ] deltaB;
   vector[NSTAT] deltaS;

 }

 model {
   vector[N] mu;
   c1 ~ normal(0,10);
   c2 ~ normal(0,10);
   c3 ~ normal(0,10);
   cN ~ normal(0,10);
   cM ~ normal(0,10);
   c4 ~ normal(0,10);
   c5 ~ normal(0,10);
   cn ~ normal(0,10);
   // c6 ~ normal(0,5);
   // chm ~ normal(12,5);
   c7 ~ normal(0,10);
   c8 ~ normal(0,10);

   
   vector[N] fm;
   vector[N] fp;
   vector[N] fs;
   // vector[N] delta;

   phiSS ~ cauchy(0,0.5);
   phiS2S ~ cauchy(0,0.5);
   tau ~ cauchy(0,0.5);

   deltaB ~ normal(0,tau);
   deltaS ~ normal(0,phiS2S);
   
   fm = c1 + c2*(M-6) + cN*log(1+exp(cn*(cM-M)));
   for (i in 1:N){
   fp[i] = c4*log(R[i]) + c5*log(sqrt(R[i]^2+50^2)) + c7*R[i];
   }
   fs = c8*VS;
   
   // delta = deltaB[idx_eq] + deltaS[idx_st];   //error epistemico
   
   mu = fm + fp + fs ;
   // + delta;
     

   Y~normal(mu,phiSS);
   
 }

r/BayesianProgramming • • Oct 16 '22

PhD Topic for Bayesian Optimal Experimental Design

2 Upvotes

r/BayesianProgramming • • Sep 27 '22

Studying & training material for non-linear models in R

2 Upvotes

Hello,

I am keen to learn Bayesian methods. I've been through some basic training to understand the main principles. I learnt (more or less!) how to fit Bayesian linear models with brms in R*.*

In my line of work I have to fit often non-linear models with nlme package in R. I want to switch them to a Bayesian approach.

What is the best resource to learn Bayesian non-linear models in R? What is the best package to use?

Thanks!

EDIT: I am thinking about non-linear models with total customized functions, not the "standardized" self-starting functions supported by stan_nlmer in rstanarm.

EDIT: I was suggested https://cran.r-project.org/web/packages/brms/vignettes/brms_nonlinear.html. Is there anything else?


r/BayesianProgramming • • Aug 28 '22

Bayes Factor or Hypothesis Testing in RJAGS

2 Upvotes

Hello all,

I've been learning Bayesian statistics for a few months now and the online course I learned teaches through Jags. I'm currently trying to apply hypothesis testing for my Master thesis with bayesian methods, but I can't find how Bayes Factor is done with JAGS. I tried to apply the solutions on a few forum pages that I could find, but it gives an error. The code I wrote is as follows;

# H2: There is a difference in internet addiction between the two countries 
mod_string = "model{
  M ~ dcat(model.p[])
  model.p[1] <- prior1
  model.p[2] <- 1-prior1


  for(i in 1:length(y)){
    y[i] ~dnorm(mu[grp[i],M],prec[M])
  }
  for(j in 1:2){
    mu[j] ~ dnorm(0,0.2)
  }
  prec[1] ~ dgamma(5/2,5*1/2)
  prec[2] ~ dgamma(5*1/2,5/2)
  sig = sqrt(1/prec)
}"
prior1 = 0.5
data_jags= list(y=dataMix$Ucla_score,
                 grp= as.numeric(dataMix$Nationality),
                 prior1=prior1)
mod = jags.model(textConnection(mod_string),
                data=data_jags,
                #inits=inits,
                n.chains=3)

This code gives the following error on the mod line;

Compiling model graph
   Resolving undeclared variables
   Allocating nodes
Deleting model

Error in jags.model(textConnection(mod_string), data = data_jags, inits = inits,  : 
  RUNTIME ERROR:
Compilation error on line 8.
Dimension mismatch taking subset of mu

As an alternative to this model, I applied a solution I found on another forum, but it still gives some errors as well. Alternative model is follows;

mod_string = "model {
  which_model ~ dbern(0.5)  # Selecting between two models.
  for(i in 1:length(y)){
    y[i] ~dnorm(mu[grp[i]]*which_model,prec) # H0: mu*0 = 0. H1: mu * 1 = mu.
  }
  for(j in 1:2){
    mu[j] ~ dnorm(0,0.2)
  }
  prec ~ dgamma(5/2,5*1/2)
  sig = sqrt(1/prec)
  
}"
data_jags= list(y=dataMix$Ucla_score,
                 grp= as.numeric(dataMix$Nationality)
                 )
params = c("mu", "sig","which_model")

inits = function(){
  inits = list("mu"=rnorm(2,0,100),"prec"=rgamma(1,1,1))
}

mod = jags.model(textConnection(mod_string),
                data=data_jags,
                inits=inits,
                n.chains=3)
update(mod,1e3)
mod_sim <-coda.samples(model=mod,
                       variable.names = params,
                       n.iter=5e3)

Up to this point everything works. But at this point I don't know how to compare these models. In the forum article I adapted the alternative model, it is compared as follows, but it gives an error.

#original forum code 
rates = xtabs(~as.matrix(mcmc_samples$which_model)) 
BF_productspace = prior * (rates[2] / rates[1]) 

When I run the first line;

> rates = xtabs(~as.matrix(mod_sim$which_model))
Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
  'data' must be of a vector type, was 'NULL'

I couldn't get past this problem. If I did, I'd get stucked again as it doesn't give any information on what the prior variable in the next line is in the forum.

If anyone knows about this, can they help? I'm open to any suggestions. I also tried with brm, I couldn't do it either.

Thank you


r/BayesianProgramming • • Jul 19 '22

ABC source recommendations?

2 Upvotes

Hi all, just wondering if there are any standout sources on approximate Bayesian computation that you would recommend?


r/BayesianProgramming • • May 01 '22

Guys and gals. Depth-based 3D video mapping, aided by bayesian computer vision. Anyone think it's possible?

Post image
2 Upvotes

r/BayesianProgramming • • Nov 28 '21

Simple BoTorch Question

2 Upvotes

I've tried looking around and sifting through documentation but I can't seem to figure out how to restrict the bounds in different ways

Is there a way to make it so inputs are chosen from a set list of options such as [2,4,6,8]? Also is there a way to limit the inputs to specifically an integer anywhere in the range 0-255?