# Tree Augmented Naive Bayes Probability of Attribute Conditioned on Parent and Class

Although this is a similar question, Factored Joint Distribution of Tree Augmented Naive Bayes Algorithm, I need additional clarification.

I have training data for two different classes, so it is fairly simple to calculate the priors for each attribute $A_i$, given the class $C$.

I am trying to determine the posterior probability from a Tree Augmented Naive Bayes algorithm.

$P(\mathrm{Class}|\mathrm{Attributes}) = P(\mathrm{Class})\cdot P(\mathrm{Root}|\mathrm{Class})\cdot \prod_i P(A_i | \mathrm{parent}, \mathrm{Class})$.

I have $P(C)$, $P(\mathrm{Root}|C)$ and all $P(A_i |C)$, however, how do I find $P(A_i |A_p, C)$ if $\mathrm{parent}$ is not equal to $\mathrm{root}$?

I think I may have answered my own question. Since I have the training data, I counted the occurrences for both $A_i$ and $A_\mathrm{parent}$ with the class $C = 0$ and $C = 1$.