本文整理匯總了Python中metrics.sequence_accuracy方法的典型用法代碼示例。如果您正苦於以下問題:Python metrics.sequence_accuracy方法的具體用法?Python metrics.sequence_accuracy怎麽用?Python metrics.sequence_accuracy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類metrics
的用法示例。
在下文中一共展示了metrics.sequence_accuracy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_sequence_accuracy_identical_samples
# 需要導入模塊: import metrics [as 別名]
# 或者: from metrics import sequence_accuracy [as 別名]
def test_sequence_accuracy_identical_samples(self):
labels_tf = tf.convert_to_tensor(self._fake_labels())
accuracy_tf = metrics.sequence_accuracy(labels_tf, labels_tf,
self.rej_char)
with self.initialized_session() as sess:
accuracy_np = sess.run(accuracy_tf)
self.assertAlmostEqual(accuracy_np, 1.0)
示例2: test_sequence_accuracy_one_char_difference
# 需要導入模塊: import metrics [as 別名]
# 或者: from metrics import sequence_accuracy [as 別名]
def test_sequence_accuracy_one_char_difference(self):
ground_truth_np = self._fake_labels()
ground_truth_tf = tf.convert_to_tensor(ground_truth_np)
prediction_tf = tf.convert_to_tensor(
self._incorrect_copy(ground_truth_np, bad_indexes=((0, 0))))
accuracy_tf = metrics.sequence_accuracy(prediction_tf, ground_truth_tf,
self.rej_char)
with self.initialized_session() as sess:
accuracy_np = sess.run(accuracy_tf)
# 1 of 4 sequences is incorrect.
self.assertAlmostEqual(accuracy_np, 1.0 - 1.0 / self.batch_size)