Hi,
I am trying to build a hierarchical regression model with target variable distributed as Weibull. Input is some ‘user’ specific feature vector and the target is a cont. variable.
The number of users in the dataset is ~5k for a smaller version of the data.
X_group = shared(train_userid.astype(int))
X_ = shared(training_data_norm)
with pm.Model() as model:
mu_a = pm.Normal('mu_a', mu=0., sigma=100)
sigma_a = pm.HalfNormal('sigma_a', 5.)
mu_b = pm.Normal('mu_b', mu=0., sigma=100)
sigma_b = pm.HalfNormal('sigma_b', 5.)
k = pm.HalfNormal('k', 5)
a = pm.Normal('a', mu=mu_a, sigma=sigma_a, shape=n_users + 1)
b = pm.Normal('b', mu=mu_b, sigma=sigma_b, shape=n_users + 1)
lamda = tt.log(1 + tt.exp(a[train_uid] + b[train_uid] * X_[:, 4]))
# Likelihood (sampling distribution) of observations
runningtime_obs = pm.Weibull('runningtime_obs', alpha=k, \
beta=lamda, observed=y_train)
I am sampling using:
with model:
start = find_MAP()
trace = pm.sample(200, tune=200, target_accept=.9, start=start)
The logp and grad goes to inf quickly. The same model without hierarchy works well. Any suggestions/recommendations?