2016-08-05 20 views
1

Es gibt viele Verlustfunktionen im Tensorfluss wie sigmoid_cross_entropy_logits, softmax_cross_entropy_logits. Könnten Sie bitte mathematische Formeln dieser Funktionen schreiben? Und was ist logits? Bezieht es sich auf this Funktion? Und wird es elementweise angewendet?Tensorflow-Verlustfunktion?

+0

Formel für Sigmoid Cross Entropie Beschreibung ist in Dokument: https://www.tensorflow.org/versions/r0.10/api_docs/python/nn.html#sigmoid_cross_entropy_with_logits –

Antwort

0

Bitte beachten Sie folgendes Beispiel:

# tf.nn.softmax computes softmax activations 
# softmax = exp(logits)/reduce_sum(exp(logits), dim) 
logits = tf.matmul(X, W) + b 
hypothesis = tf.nn.softmax(logits) 

# Cross entropy cost/loss 
loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits, 
              labels=Y_one_hot)) 

Die Logit Ausgabe von Ihrem Modell ist (vor softmax). Das vollständige Beispiel finden Sie unter https://github.com/hunkim/DeepLearningZeroToAll/blob/master/lab-06-2-softmax_zoo_classifier.py.