BrokenProcessPool Error

Hi,

I am new to the Bayesian modelling world, and this is the first time I am using pystan for a Recommender Systems project.

I am trying to model user clicks using a simple Bayesian model with clicks being modelled as a binomial variable (for each user, item pairs). The number of impressions is the total number of trails for a given (user, item) pair and ‘click’ is a success.

The corresponding pystan code is as follows:

non_hierarchical_model = """
data{
int U;
int I;
int N;

int<lower=1> click[N];
int<lower=1> impressions[N];
int<lower=0> prod_idx[N];
int<lower=0> user_idx[N];
}

parameters {
  real<lower=0, upper=1> Alpha[I];
  real<lower=0, upper=1> Beta[I];
  
  real<lower=0, upper=1> Alpha1[U];
  real<lower=0, upper=1> Beta1[U];
  
  real<lower=0, upper=1> obs[N];
  real<lower=0, upper=1> rel[N];
  
}

model{

for (n in 1:N) {
    Alpha[prod_idx[n]] ~ beta(0.5, 0.5);
    Beta[prod_idx[n]] ~ beta(0.5,  0.5);
    
    Alpha1[user_idx[n]] ~ beta(0.5, 0.5);
    Beta1[user_idx[n]] ~ beta(0.5,  0.5);
    
    obs[n] ~ beta(Alpha[prod_idx[n]], Beta[prod_idx[n]]);
    rel[n] ~ beta(Alpha1[user_idx[n]], Beta1[user_idx[n]]);
    
    click[n] ~ binomial_logit(impressions[n],  obs[n] * rel[n]);
  }
}

"""

I am trying to model clicks as Observation * Relevance, where observation is defined for items and relevance is defined for users, and the final click probability is the product of the two.

When I try to sample from this model, I am getting the following error:

RuntimeError: Exception during call to services function: `BrokenProcessPool('A process in the process pool was terminated abruptly while the future was running or pending.')`, traceback: `['  File "/ivi/ilps/personal/sgupta/anaconda3/envs/pystan/lib/python3.7/site-packages/httpstan/services_stub.py", line 153, in call\n    future.result()\n']`

I have tried putting the code inside “main” block as per some discussion, but no success. Is it because of some modelling issue or something else all together?

How do you call pystan?

What os?

Thanks for your response!

I am calling it using:

posterior = stan.build(non_hierarchical_model, data=data)
fit = posterior.sample(num_chains=1, num_samples=100)

I am running it on CentOS Linux server.