Representation of Probability

To represent and modifies probabilities such as

\[P(x, y|z),\]

one can define an instance of Prob and change its attributes.

class ylearn.causal_model.prob.Prob(variables=set(), conditional=set(), divisor=set(), marginal=set(), product=set())

Probability distribution, e.g., the probability expression

\[\sum_{w}P(v|y)[P(w|z)P(x|y)P(u)].\]

We will clarify below the meanings of our variables with this example.

Parameters:
  • variables (set, default=set()) – The variables (\(v\) in the above example) of the probability.

  • conditional (set, default=set()) – The conditional set (\(y\) in the above example) of the probability.

  • marginal (set, default=set()) – The sum set (\(w\) in the above example) for marginalizing the probability.

  • product (set, default=set()) – If not set(), then the probability is composed of the first probability object \((P(v|y))\) and several other probabiity objects that are all saved in the set product, e.g., product = {P1, P2, P3} where P1 for \(P(w|z)\), P2 for \(P(x|y)\), and P3 for \(P(u)\) in the above example.

parse()

Return the expression of the probability distribution.

Returns:

Expression of the encoded probabiity

Return type:

str

show_latex_expression()

Show the latex expression.