MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / free_energy

Method free_energy

unsupervised_class2/rbm_tf.py:92–103  ·  view source on GitHub ↗
(self, V)

Source from the content-addressed store, hash-verified

90 plt.show()
91
92 def free_energy(self, V):
93 b = tf.reshape(self.b, (self.D, 1))
94 first_term = -tf.matmul(V, b)
95 first_term = tf.reshape(first_term, (-1,))
96
97 second_term = -tf.reduce_sum(
98 # tf.log(1 + tf.exp(tf.matmul(V, self.W) + self.c)),
99 input_tensor=tf.nn.softplus(tf.matmul(V, self.W) + self.c),
100 axis=1
101 )
102
103 return first_term + second_term
104
105 def forward_hidden(self, X):
106 return tf.nn.sigmoid(tf.matmul(X, self.W) + self.c)

Callers 1

buildMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected