概率表达式

YLearn能够输出和修改类似如下的概率表达式:

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

用户能够定义一个 Prob 的实例,以及改变它的属性.

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

一个概率分布表达式如下:

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

用上述例子来阐明参数的含义:

参数:
  • 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 probability 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()

返回概率分布的表达式

返回:

Expression of the encoded probability

返回类型:

str

show_latex_expression()

显示latex表达式