Skip to content

Basic R code which use backpropagation to learn parameters in a Bayesian Network

Notifications You must be signed in to change notification settings

mikeb127/Bayesnet-Backpropagation

Repository files navigation

Bayesnet-Backpropagation

Basic R code which use backpropagation to learn parameters in a Bayesian Network. This is more a demonstration/tutorial rather than a usable library. It assumes that you know how backpropagation works in neural networks/some other variety of model.

This repo is a basic demonstration of using backpropagation to learn CPT values in a Bayesian Network. I have used PDF images of networks from Netica to visualize the before and after results, however it is not nescessary to have Netica to execute the code.

We start with the Bayesian Network in the before file in the repo:

image

However, we later go to validate the network against observed data and find that the probabilities associated with the nodes for Wet_Grass and Take_Off_From_Work are incorrect. We find that the probability for Wet_Grass is 60%, and the probability for Take_Off_From_Work is 10%. As such, we update the ground truth values in the R code.

image

And then execute:

image

Finally, I copied the new values from the CPTs into the Netica network, which now results in the probabilities below. Note that there are a few differences as Netica requires significant rounding when compared to the CPT's produced by the R code. A pdf copy of this network is also in the repo.

image

Thanks for reading :)

About

Basic R code which use backpropagation to learn parameters in a Bayesian Network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages