Specifying the Non-Decoder/Encoder Parameters of the Model
How to get the conditional probability values ?
In this section, we'll cover how to get the conditional probabilities for the queries we are interested in. The first step is to implement the DAG. The process is much similar to what we have seen in pyro except that we get the probabilities using graph propagation techniques for the Bayesian network instead of running inference algorithms. This way is usually much faster to compute than inference algorithms.
We use these methods as we are pre-computing the probabilities
The initial prior probabilities are assumed and we fit the probabilities to the DAG using the bnlearn custom fit method. In this DAG, the image node is not considered. Once this DAG is fit, we can query the DAG to get the conditional probabilities of any node given some evidence.
Conditional probability queries using gRain
gRain package computes stable conditional probability values. We have written code to automatically get the probabilities for the nodes we are interested in. We convert the bnlearn fit object to a grain object using bnlearn as.grain method.
library(gRain)
grainObj <- as.grain(dfit)
We use the above-created grain object to query. A sample query might look like below,