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

Method get_cost

nlp_class2/rntn_tensorflow.py:153–157  ·  view source on GitHub ↗
(self, logits, labels, reg)

Source from the content-addressed store, hash-verified

151 plt.show()
152
153 def get_cost(self, logits, labels, reg):
154 cost = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels))
155 rcost = sum(tf.nn.l2_loss(p) for p in self.params)
156 cost += reg*rcost
157 return cost
158
159 # list_of_logits is an output!
160 # it is added to using post-order traversal

Callers 1

fitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected