和积算法。因子图的(循环)信念传播(消息传递)
sumproduct的Python项目详细描述
`消费品` `
===================================================
《消费品》网站 《消费品算法》
(`reference<;http://http://webhttp://http://http://http://www.http://www.http://www=======================4.cs.ucl.ac.uk/staff/d.barber/pmwiki/pmwiki.php?n=brml.homepage>;`` uu.
:
…图:http://f.cl.ly/items/2p021j2y3a2q191f451h/unnamed0.png
:alt:simple factor graph
simple factor graph
test.py`(使用http://www.yworks.com/en/products-yed-applicationfeatures.html制作的图像)中使用的因子图;`_。
基本用法
----
创建因子图
~~~~~~~~~~~~~~~~~~~~~~~~~
:
2)init具有2个状态的变量
x2=变量('x2',3)init具有3个状态的变量
f12=因子('f12',np.数组([
[0.8,0.2],
[0.2,0.8],
[0.5,0.5]
])创建因子,p(x1 x2)
将父节点连接到子节点
g.add(f12)
g.append('f12',x2)顺序必须与因子势中的维度相同!
g.append('f12',x1);;注:f12势的形状是(3,2),即(x2,x1)
>运行推理
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>
>>;g.compute marginal s(
>>>;g.g.g.g.g.g.compute marginals(
>>>>;g;g.g.节点['x1'].marginal()
数组([0.5,0.5])
如果你有一个循环图的话,就用蛮力方法(在计算上花费巨大的费用)来检查一下吧。
:
:
>
><
>gt;g.brute-force()
>;g.nodes['x1'].bfmarginal
数组([0.5,0.5])
关于观测的条件
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^br/>>>>;g.观察('x2',2)观察状态1(12层以上电位的中间)
>;>g.计算边缘(最大值=500,公差=1e-6)
>;>g.节点['x1'].marginal()
数组([0.2,0.8])
>;>g.蛮力()
>;>g.节点['x1'].bmarginal
数组([0.2,0.8])
示例。
implementation details
——
有关详细信息,请参见代码方法中的块注释,但是
实现策略来自“david barber's
book<;http://web4.cs.ucl.ac.uk/staff/d.barber/pmwiki/pmwiki.php”的第5章?n=brml.主页|构建状态图像::https://travis-ci.org/ilyakava/sumproduct.svg?branch=master
:目标:https://travis ci.org/ilyakava/sumproduct
…|下载图像::https://pypip.in/download/sumproduct/badge.svg
:目标:https://pypi.python.org/pypi/sumproduct/
===================================================
《消费品》网站
(`reference<;http://http://webhttp://http://http://http://www.http://www.http://www=======================4.cs.ucl.ac.uk/staff/d.barber/pmwiki/pmwiki.php?n=brml.homepage>;`` uu.
:
…图:http://f.cl.ly/items/2p021j2y3a2q191f451h/unnamed0.png
:alt:simple factor graph
simple factor graph
test.py`(使用http://www.yworks.com/en/products-yed-applicationfeatures.html制作的图像)中使用的因子图;`_。
基本用法
----
创建因子图
~~~~~~~~~~~~~~~~~~~~~~~~~
:
2)init具有2个状态的变量
x2=变量('x2',3)init具有3个状态的变量
f12=因子('f12',np.数组([
[0.8,0.2],
[0.2,0.8],
[0.5,0.5]
])创建因子,p(x1 x2)
将父节点连接到子节点
g.add(f12)
g.append('f12',x2)顺序必须与因子势中的维度相同!
g.append('f12',x1);;注:f12势的形状是(3,2),即(x2,x1)
>运行推理
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>
>>;g.compute marginal s(
>>>;g.g.g.g.g.g.compute marginals(
>>>>;g;g.g.节点['x1'].marginal()
数组([0.5,0.5])
如果你有一个循环图的话,就用蛮力方法(在计算上花费巨大的费用)来检查一下吧。
:
:
>
><
>gt;g.brute-force()
>;g.nodes['x1'].bfmarginal
数组([0.5,0.5])
关于观测的条件
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^br/>>>>;g.观察('x2',2)观察状态1(12层以上电位的中间)
>;>g.计算边缘(最大值=500,公差=1e-6)
>;>g.节点['x1'].marginal()
数组([0.2,0.8])
>;>g.蛮力()
>;>g.节点['x1'].bmarginal
数组([0.2,0.8])
示例。
implementation details
——
有关详细信息,请参见代码方法中的块注释,但是
实现策略来自“david barber's
book<;http://web4.cs.ucl.ac.uk/staff/d.barber/pmwiki/pmwiki.php”的第5章?n=brml.主页|构建状态图像::https://travis-ci.org/ilyakava/sumproduct.svg?branch=master
:目标:https://travis ci.org/ilyakava/sumproduct
…|下载图像::https://pypip.in/download/sumproduct/badge.svg
:目标:https://pypi.python.org/pypi/sumproduct/