Using frameworks like Figaro it is possible to do probabilistic programming by variable elimination to build a probabilistic model and then run inferences against it in a very intuitive way. Example:
import com.cra.figaro.language._
import com.cra.figaro.algorithm.factored.VariableElimination
import com.cra.figaro.library.compound.If
val sunnyToday = Flip(0.2)
println(VariableElimination.probability(sunnyToday, true))
Will print 0.2
But then you can add:
val greetingToday = If(sunnyToday, Select(0.6->"Hello, world!", 0.4->"Howdy, universe!"),
Select(0.2->"Hello, world!", 0.8->"Oh no, not again!"))
And state that you have observed "Hello, world!"
greetingToday.observe("Hello, world!")
println(VariableElimination.probability(sunnyToday,true))
And you will get 0.4285
And after that you can remove that observation:
greetingToday.unobserve()
println(VariableElimination.probability(sunnyToday,true))
and you will get 0.2
And you can even chain this further and represent conditional probabilities for the next day...
I have the nagging feeling that Mathematica's Probability should be able to describe this high level operations intuitively and make the same calculations, but I have been unable to find such an example anywhere... Is it possible to do this with plain mathematica? Or is Probability too low level and a higher level framework has yet to be built on top of it to achieve something like this?