本文整理汇总了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)