# Example of a hybrid Bayesian Network

**URL:** <https://discourse.pymc.io/t/example-of-a-hybrid-bayesian-network/2713>\
**Category:** Questions\
**Created:** [February 13, 2019, 1:52pm UTC](https://discourse.pymc.io/t/example-of-a-hybrid-bayesian-network/2713 "2019-02-13T13:52:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Ebbelaar](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@Dave\_Ebbelaar](https://discourse.pymc.io/u/Dave_Ebbelaar)\
**Post date:** [February 13, 2019, 1:52pm UTC](https://discourse.pymc.io/t/example-of-a-hybrid-bayesian-network/2713/1 "2019-02-13T13:52:15Z")

</div>

I am trying to build a hybrid Bayesian network (discrete and continues variables), learn the parameters from data, and then use the model for inference. Now I am wondering if this is possible in pymc3 and if so, is there some example code available?

Suggestions for other (Python) libraries are welcome as well. However, I’ve found that most of the available packages do not satisfy the requirements out of the box.

---

<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:** [February 13, 2019, 3:09pm UTC](https://discourse.pymc.io/t/example-of-a-hybrid-bayesian-network/2713/2 "2019-02-13T15:09:52Z")

</div>

If the discrete variables are observed, this could be done relatively easily.  
If they are latent, well… good luck…

---

<div class="post-metadata">

**Author:** ![Dave\_Ebbelaar](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@Dave\_Ebbelaar](https://discourse.pymc.io/u/Dave_Ebbelaar)\
**Post date:** [February 13, 2019, 3:35pm UTC](https://discourse.pymc.io/t/example-of-a-hybrid-bayesian-network/2713/3 "2019-02-13T15:35:01Z")

</div>

To give a little more context: I am trying to model marketing campaign effects. The data contains several (discrete) campaign properties and effects in term of KPIs which are continuous (e.g. Revenue).

By doing inference, the goal is to see what type of campaigns are most likely to increase certain KPIs.

Any tips on how to proceed?

---

<div class="post-metadata">

**Author:** ![lucianopaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/lucianopaz/32/2186_2.png) [@lucianopaz](https://discourse.pymc.io/u/lucianopaz)\
**Post date:** [February 13, 2019, 4:21pm UTC](https://discourse.pymc.io/t/example-of-a-hybrid-bayesian-network/2713/4 "2019-02-13T16:21:51Z")

</div>

I recommend you look at Bayesian A/B testing (@springcoil has some nice [notebooks](https://github.com/springcoil/probabilisticprogrammingprimer/blob/master/notebooks/Bayesian_AB_Testing.ipynb)), and [hierarchical models](https://docs.pymc.io/notebooks/multilevel_modeling.html), so you get a notion of how to handle observed discrete groups.

---

<div class="post-metadata">

**Author:** ![arubiales](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arubiales](https://discourse.pymc.io/u/arubiales)\
**Post date:** [June 26, 2019, 10:37am UTC](https://discourse.pymc.io/t/example-of-a-hybrid-bayesian-network/2713/5 "2019-06-26T10:37:36Z")

</div>

I have exactly the same problem than you Dave\_Ebbelaar!!! have you found any way to solve??

Thank you very much! 🙂
