Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
636c2d80
提交
636c2d80
authored
2月 06, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added incomplete proposal: graphical_models extension
上级
d96682ce
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
78 行增加
和
0 行删除
+78
-0
graphical_models.txt
doc/proposals/graphical_models.txt
+78
-0
没有找到文件。
doc/proposals/graphical_models.txt
0 → 100644
浏览文件 @
636c2d80
==================================================================
Random Numbers, Random Variables and Compiling Graphical Models
==================================================================
.. note:
Proposed 2010 02 06
Objective
=========
It might be nice to use Theano as a language and compiler for questions about
graphical models.
In this way, we could express something like Logistic Regression like this:
.. code-block:: python
from theano import random_variable as RV
X, Y, s_idx = RV.empirical(my_dataset)
# model parameters
v = shared(numpy.zeros(()))
b = shared(numpy.zeros(()))
Y_hat = RV.multinomial(n=1, p=softmax(dot(X,v)+b))
cost = sum(-log(Y_hat.density(Y)))
train_fn = function([s_idx], cost, updates=[[v,b], grad(cost, [v,b]]))
.. code-block:: python
RandomVariable(Variable)
def sample(self, n):
"""[Symbolically] draw a sample of size n"""
def density(self, pt, givens={}):
"""Conditional Density/Probability of P(self=pt)
Implicitly conditioned on knowing the values of all variables
on which this one depends. Optionally override ancestor variables
using givens.
"""
def mode(self):
"""Return expression of the most likely value of this distribution"""
We would really like to integrate out certain variables sometimes...
An RBM could be expressed like this:
.. code-block:: python
w = shared(initial_weights)
v = shared(initial_visible_biases)
u = shared(initial_hidden_biases)
visible = RV.binomial(n=1, p=None) # p filled in by EnergyModel
hidden = RV.binomial(n=1, p=None) # p filled in by EnergyModel
energy = dot(visible,v) + dot(hidden, u) + dot(dot(visible, w), hidden)
RBM = EnergyModel(energy, variables={'visible':visible, 'hidden':hidden], params=[w,v,u])
RBM.energy(v,h) # an expression for the energy at point (v,h)
RBM.visible.energy(h) # an expression for the free energy
RBM.hidden.energy(h) # an expression for the free energy
v_given_h = RBM.visible.conditional(h) # a random variable
Rather than program all the training algorithms into an RBM module,
the idea would be to express the relationship between RBM variables so that we
could automatically recognize how to do Gibbs sampling, gradient descent on Free
Energy, etc.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论