本文整理汇总了Python中rbm.RBM.backward方法的典型用法代码示例。如果您正苦于以下问题:Python RBM.backward方法的具体用法?Python RBM.backward怎么用?Python RBM.backward使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rbm.RBM
的用法示例。
在下文中一共展示了RBM.backward方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ulogprob_hid
# 需要导入模块: from rbm import RBM [as 别名]
# 或者: from rbm.RBM import backward [as 别名]
def _ulogprob_hid(self, Y, num_is_samples=100):
"""
Estimates the unnormalized marginal log-probabilities of hidden states.
Use this method only if you know what you are doing.
"""
# approximate this SRBM with an RBM
rbm = RBM(self.X.shape[0], self.Y.shape[0])
rbm.W = self.W
rbm.b = self.b
rbm.c = self.c
# allocate memory
Q = np.asmatrix(np.zeros([num_is_samples, Y.shape[1]]))
for k in range(num_is_samples):
# draw importance samples
X = rbm.backward(Y)
# store importance weights
Q[k, :] = self._ulogprob(X, Y) - rbm._clogprob_vis_hid(X, Y)
# average importance weights to get estimates
return utils.logmeanexp(Q, 0)