當前位置: 首頁>>代碼示例>>Python>>正文


Python metrics.sequence_accuracy方法代碼示例

本文整理匯總了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) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:11,代碼來源:metrics_test.py

示例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) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:15,代碼來源:metrics_test.py


注:本文中的metrics.sequence_accuracy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。