Open tuki0918 opened 7 years ago
誤差評価
# label:正解の値, inference:予測された値 # http://stackoverflow.com/questions/33712178/tensorflow-nan-bug # cross_entropy = -tf.reduce_sum(label * tf.log(inference + 1e-10)) cross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(inference, label)) train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
# https://github.com/tuki0918/jupyter_tfbook/blob/master/Chapter05/MNIST%20double%20layer%20CNN%20classification.ipynb keep_prob = tf.placeholder(tf.float32) hidden2_drop = tf.nn.dropout(hidden2, keep_prob) w0 = tf.Variable(tf.zeros([num_units2, 10])) b0 = tf.Variable(tf.zeros([10])) p = tf.nn.softmax(tf.matmul(hidden2_drop, w0) + b0) t = tf.placeholder(tf.float32, [None, 10]) loss = -tf.reduce_sum(t * tf.log(p)) train_step = tf.train.AdamOptimizer(0.0001).minimize(loss) correct_prediction = tf.equal(tf.argmax(p, 1), tf.argmax(t, 1)) accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
http://tensorflow.classcat.com/
最初に
Learning
API
Tensorboard
Data Augmentation
リンク
リンク(実装)
誤差評価