MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / get_cost

Method get_cost

nlp_class2/recursive_tensorflow.py:140–149  ·  view source on GitHub ↗
(self, logits, labels, reg)

Source from the content-addressed store, hash-verified

138 plt.show()
139
140 def get_cost(self, logits, labels, reg):
141 cost = tf.reduce_mean(
142 input_tensor=tf.nn.sparse_softmax_cross_entropy_with_logits(
143 logits=logits,
144 labels=labels
145 )
146 )
147 rcost = sum(tf.nn.l2_loss(p) for p in self.params)
148 cost += reg*rcost
149 return cost
150
151 # list_of_logits is an output!
152 # it is added to using post-order traversal

Callers 1

fitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected