# How to implement factorization machine using pymc3?

**URL:** <https://discourse.pymc.io/t/how-to-implement-factorization-machine-using-pymc3/3885>\
**Category:** Questions\
**Created:** [September 20, 2019, 10:47pm UTC](https://discourse.pymc.io/t/how-to-implement-factorization-machine-using-pymc3/3885 "2019-09-20T22:47:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![1112](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/1112/32/2225_2.png) [@1112](https://discourse.pymc.io/u/1112)\
**Post date:** [September 20, 2019, 10:47pm UTC](https://discourse.pymc.io/t/how-to-implement-factorization-machine-using-pymc3/3885/1 "2019-09-20T22:47:54Z")

</div>

[the output of FM.] ([https://i.stack.imgur.com/R9wMZ.png](https://i.stack.imgur.com/R9wMZ.png))How to implement the FM model using pymc3? Typically, I have trouble customizing the distribution of output Y

I used to learn how to implement bpmf using pymc3 from : [https://github.com/dockerizeme/dockerizeme/blob/d651393988c5fc87f15553d20f4930a97fcfbcfd/hard-gists/00a17b1d374dfc267a9a/snippet.py](https://github.com/dockerizeme/dockerizeme/blob/d651393988c5fc87f15553d20f4930a97fcfbcfd/hard-gists/00a17b1d374dfc267a9a/snippet.py)

Y = pm.Noraml(‘Y’, mu = w\_0 + np.dot(W, X) + 0 , tau = alpha \* np.ones((n,1)), observed = labels)
