# Parameter learning of hidden(latent) nodes for arbitrary bayesian network

**URL:** <https://discourse.edwardlib.org/t/parameter-learning-of-hidden-latent-nodes-for-arbitrary-bayesian-network/659>\
**Category:** General\
**Created:** [March 7, 2018, 3:21am UTC](https://discourse.edwardlib.org/t/parameter-learning-of-hidden-latent-nodes-for-arbitrary-bayesian-network/659 "2018-03-07T03:21:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrtucci](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.edwardlib.org/rrtucci/32/216_2.png) [@rrtucci](https://discourse.edwardlib.org/u/rrtucci)\
**Post date:** [March 7, 2018, 3:21am UTC](https://discourse.edwardlib.org/t/parameter-learning-of-hidden-latent-nodes-for-arbitrary-bayesian-network/659/1 "2018-03-07T03:21:55Z")

</div>

The following notebook runs without reporting errors but gives random junk answers. If anyone is interested in the same topic, and finds why it doesn’t work, I’d appreciate finding out how to fix it.

The notebook writes an edward model for  
the classic bayesian net “WetGrass” that looks like this with all arrows pointing down

```auto
   Cloudy
  / \
Rain Sprinkler
  \ /
  WetGrass

```

The goal is to learn the node conditional prob tables of two latent (hidden) nodes Rain and Sprinkler, given data consisting of multiple observations of the nodes Cloudy and WetGrass. I use batch training and KLqp Inference.

## References

- [Simple Bayesian Network/ Sprinkler example](https://discourse.edwardlib.org/t/simple-bayesian-network-sprinkler-example/258)
- [http://edwardlib.org/tutorials/batch-training](http://edwardlib.org/tutorials/batch-training)
- [Parameter Learning with Simple Bayesian Network; PyMC3 vs. Edward; Edward posteriors not converging around correct parameter values](https://discourse.edwardlib.org/t/parameter-learning-with-simple-bayesian-network-pymc3-vs-edward-edward-posteriors-not-converging-around-correct-parameter-values/653/3)

Update (March 9, 2018)

* * *

Found serious conceptual mistake in previous notebook so deleted it. Wrote 2 new notebooks without previous mistake. Neither of them gives error message, but both fail to converge, so still need help

- [https://github.com/artiste-qb-net/quantum-fog/blob/master/jupyter-notebooks/inference\_via\_ext\_software/WetGrass\_param\_learn\_KLqp\_edward.ipynb](https://github.com/artiste-qb-net/quantum-fog/blob/master/jupyter-notebooks/inference_via_ext_software/WetGrass_param_learn_KLqp_edward.ipynb)
- [https://github.com/artiste-qb-net/quantum-fog/blob/master/jupyter-notebooks/inference\_via\_ext\_software/WetGrass\_param\_learn\_MC\_edward.ipynb](https://github.com/artiste-qb-net/quantum-fog/blob/master/jupyter-notebooks/inference_via_ext_software/WetGrass_param_learn_MC_edward.ipynb)
