0

For example, let's say I have the following conditional probability:

P(competitive=1(yes) | currency=EUR, sellerRating=1000)

If I run the following code, I'll get a probability table:

library(e1071)
nb.model <- naiveBayes(Competitive~., data=trainLabel)
nb.model

enter image description here

So when competitive=1 and currency = EUR, the probability is 0.283.

But how would I get the probability for sellerRating=1000, given competitive=1 and currency=EUR?

With the above code, it seems like getting the probability for categorical variables is easy, but I don't know how to get it for exact numbers.

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Good question, however, it's off topic here since it's not a specific programming question; try stats.stackexchange.com instead. The right way to go about problems like this is to explicitly model the relationships between the variables, and then use Bayes' rule (or generalizations of it, usually) to derive conditional distributions which are implicit in the model. In this case, you could look at the distribution of sellerRating conditional on competitive and currency -- this would be a 2 by N table (with N = number of currencies) of continuous distributions. – Robert Dodier Feb 02 '23 at 17:17
  • Then you have p(sellerRating | competitive, currency). Apply the appropriate form of Bayes' rule to get p(competitive | sellerRating, currency). You can do this by hand; automating this process leads to Bayesian belief networks -- a web search will find resources about that. Good luck and have fun. – Robert Dodier Feb 02 '23 at 17:18

0 Answers0