[ML]tensorflow計算分類准確率


1 def compute_accuracy(v_xs, v_ys):
2     global prediction
3     y_pre = sess.run(prediction, feed_dict={xs: v_xs, keep_prob: 1})
4     correct_prediction = tf.equal(tf.argmax(y_pre,1), tf.argmax(v_ys,1))
5     accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
6     result = sess.run(accuracy, feed_dict={xs: v_xs, ys: v_ys, keep_prob: 1})
7     return result

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM