# How to create Von mises and uniform mixture model with Pymc3

**URL:** <https://discourse.pymc.io/t/how-to-create-von-mises-and-uniform-mixture-model-with-pymc3/2042>\
**Category:** Questions\
**Created:** [October 9, 2018, 11:45am UTC](https://discourse.pymc.io/t/how-to-create-von-mises-and-uniform-mixture-model-with-pymc3/2042 "2018-10-09T11:45:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![menghhh](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@menghhh](https://discourse.pymc.io/u/menghhh)\
**Post date:** [October 9, 2018, 11:45am UTC](https://discourse.pymc.io/t/how-to-create-von-mises-and-uniform-mixture-model-with-pymc3/2042/1 "2018-10-09T11:45:27Z")

</div>

I am new to Pymc3 and currently doing a parameter estimation with it. I have a data set which is assumed to be a mixture of a uniform distribution and a Von-mises distribution. I want to know the model weights and I set my model like this:

```python
with model:
   #uniform
   uni = pm.Uniform.dist('uni', lower = -180, upper = 180)    
   #Von-mises
   kappa = pm.Uniform('kappa', lower = 0, upper = 50)    
   von = pm.VonMises.dist("von", mu = 0, kappa = kappa)        
   #mixture model 
   w = pm.Dirichlet('w', a=np.array([1, 1]), shape = 2)
   like = pm.Mixture('like', w=w, comp_dists = [von, uni], observed=target)

```

but it gives the error:  
TypeError: **init** () got multiple values for keyword argument ‘lower’

I was wondering if the problem is from the script, or I can not use py.Mixture fuction to do the analysis of two different distribution type. And is there any other method that I could do that since basically all the resources are about Gaussian mixture model.

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [October 9, 2018, 12:20pm UTC](https://discourse.pymc.io/t/how-to-create-von-mises-and-uniform-mixture-model-with-pymc3/2042/2 "2018-10-09T12:20:07Z")

</div>

If you are initializing a distribution, the name arg is not needed:

```python
    ...
    uni = pm.Uniform.dist(lower = -180, upper = 180) 

```

---

<div class="post-metadata">

**Author:** ![jstanley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jstanley/32/3711_2.png) [@jstanley](https://discourse.pymc.io/u/jstanley)\
**Post date:** [March 4, 2020, 1:16am UTC](https://discourse.pymc.io/t/how-to-create-von-mises-and-uniform-mixture-model-with-pymc3/2042/3 "2020-03-04T01:16:12Z")

</div>

_“I was wondering if the problem is from the script, or I can not use py.Mixture fuction to do the analysis of two different distribution type. And is there any other method that I could do that since basically all the resources are about Gaussian mixture model.”_

Did you ever get an answer to this question? I’m attempting to do the same thing. I tried using your code as an example, but am having the same error.

---

<div class="post-metadata">

**Author:** ![sammosummo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/sammosummo/32/96_2.png) [@sammosummo](https://discourse.pymc.io/u/sammosummo)\
**Post date:** [March 4, 2020, 1:42am UTC](https://discourse.pymc.io/t/how-to-create-von-mises-and-uniform-mixture-model-with-pymc3/2042/4 "2020-03-04T01:42:59Z")

</div>

@menghhh did get an answer. The `.dist` method doesn’t take a `name` argument.
