# Mixture of Linear Regression: How?

**URL:** <https://discourse.edwardlib.org/t/mixture-of-linear-regression-how/673>\
**Category:** General\
**Created:** [March 13, 2018, 7:47am UTC](https://discourse.edwardlib.org/t/mixture-of-linear-regression-how/673 "2018-03-13T07:47:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![hayato-n](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@hayato-n](https://discourse.edwardlib.org/u/hayato-n)\
**Post date:** [March 14, 2018, 5:53am UTC](https://discourse.edwardlib.org/t/mixture-of-linear-regression-how/673/3 "2018-03-14T05:53:37Z")

</div>

With PyMC3, `Categorical` Distribution can be used as index.  
(see [https://stats.stackexchange.com/questions/185812/regression-mixture-in-pymc3](https://stats.stackexchange.com/questions/185812/regression-mixture-in-pymc3))

But with Edward, slice or `tf.gather` do not work for `ed.Gibbs`.

On the other hand, if I use `ed.MetropolisHastings`, it works. (I reached this method thanks to [this post](https://discourse.edwardlib.org/t/dpm-model-for-clustering/97/5))  
But because acceptance rate is very small (less than 0.1), it looks not converge.

---

_[View the full topic](https://discourse.edwardlib.org/t/mixture-of-linear-regression-how/673)._
