# Weibull mixture model with the Dirichlet process priori

I meet some problems when I build a Weibull mixture model with the Dirichlet process priori. I want to know there is anyone who meets these problems and how to solve these.
This is the code:

``````import numpy as np
import pymc3 as pm
import arviz as az
from theano import tensor as tt
import scipy as sp

def stick_breaking(beta):
portion_remaining = tt.concatenate([[1], tt.extra_ops.cumprod(1 - beta)[:-1]])

return beta * portion_remaining

shape = np.random.gamma(2, 2, size=5)
scale = np.random.gamma(1, 2, size=5)
test = np.array([])
for i, j in zip(shape, scale):
test = np.hstack((test, sp.stats.weibull_min(i, scale=j).rvs(20)))
np.random.shuffle(test)

K = 5

with pm.Model() as model:
alpha = pm.Gamma("alpha", 1.0, 1.0)
beta = pm.Beta("beta", 1, alpha, shape=K)
w = pm.Deterministic("w", stick_breaking(beta))

sh = pm.Gamma("sh", 2, 2, shape=K)
sc = pm.Gamma("sc", 1, 2, shape=K)
components = pm.Weibull.dist(alpha=sh, beta=sc, shape=K)
obs = pm.Mixture("obs", w, comp_dists=components, observed=test)
trace = pm.sample(1000,  chains=4, init="advi", target_accept=0.8)
``````

The error is:

``````SamplingError: Initial evaluation of model at starting point failed!
Starting values:
{'alpha_log__': array(0.), 'beta_logodds__': array([0.69314718, 0.69314718, 0.69314718, 0.69314718, 0.69314718]), 'sh_log__': array([0., 0., 0., 0., 0.]), 'sc_log__': array([-0.69314718, -0.69314718, -0.69314718, -0.69314718, -0.69314718])}

Initial evaluation results:
alpha_log__      -1.00
beta_logodds__   -6.08
sh_log__         -3.07
sc_log__         -5.00
obs               -inf
Name: Log-probability of test_point, dtype: float64
``````

I konw how to do now. The problem is the K is too small.