I have the following model:

```
pOn ~ Beta(alpha, beta)
on ~ Bernoulli(pOn)
w = [on, (1 - on)]
tri_giv_on ~ Bernoulli(p)
tri_giv_not_on ~ Bernoulli(q)
triangle ~ BernoulliMixture(w, [tri_giv_on, tri_giv_not_on])
```

I’ve tried to implement it using pymc3

```
with pymc3.Model() as model:
pOn = pymc3.Beta('pOn', alpha=on_count, beta=(schema_count - on_count));
on = pymc3.Bernoulli('on', pOn)
triangle_mixture_weights = [on, (1. - on)]
tri_giv_on = pymc3.Bernoulli.dist(pTri_given_not_on + tri_delta_on)
tri_giv_not_on = pymc3.Bernoulli.dist(pTri_given_not_on)
triangle = pymc3.Mixture('triangle', w=triangle_mixture_weights, \
comp_dists=[tri_giv_on, tri_giv_not_on], \
shape=2)
res = pymc3.sample_prior_predictive(1000)
```

So, the model isn’t perfect. There are some things I can do to make it better, but still,I’m thinking that conceptually, this should work. This, however, isn’t the case. When I run the model, python tells me:

```
Traceback (most recent call last):
File "test.py", line 114, in <module>
res = pymc3.sample_prior_predictive(n)
File "/usr/local/lib/python2.7/dist-packages/pymc3/sampling.py", line 1325, in sample_prior_predictive
values = draw_values([model[name] for name in names], size=samples)
File "/usr/local/lib/python2.7/dist-packages/pymc3/distributions/distribution.py", line 369, in draw_values
size=size)
File "/usr/local/lib/python2.7/dist-packages/pymc3/distributions/distribution.py", line 463, in _draw_value
return param.random(point=point, size=size)
File "/usr/local/lib/python2.7/dist-packages/pymc3/model.py", line 43, in __call__
return getattr(self.obj, self.method_name)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pymc3/distributions/mixture.py", line 166, in random
size=size).squeeze()
File "/usr/local/lib/python2.7/dist-packages/pymc3/distributions/distribution.py", line 621, in generate_samples
samples = [generator(*args, **kwargs).reshape(size_tup + (1,)) for _ in range(np.prod(suffix, dtype=int))]
File "/usr/local/lib/python2.7/dist-packages/pymc3/distributions/dist_math.py", line 322, in random_choice
size = kwargs.pop('size')
KeyError: 'size'
```

I’m not exactly sure what this error is about, but python is happy when I replace `pOn`

and `on`

random variables with a new scalar variable `on = 1.`

.

**NOTE:** When i do `pymc3.sample(1000)`

instead of `pymc3.sample_prior_predictive(1000)`

, python is happy too.