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


Python evaluation.Results類代碼示例

本文整理匯總了Python中Orange.evaluation.Results的典型用法代碼示例。如果您正苦於以下問題:Python Results類的具體用法?Python Results怎麽用?Python Results使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Results類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_F1_multiclass

 def test_F1_multiclass(self):
     results = Results(
         domain=Domain([], DiscreteVariable(name="y", values="01234")),
         actual=[0, 4, 4, 1, 2, 0, 1, 2, 3, 2])
     results.predicted = np.array([[0, 1, 4, 1, 1, 0, 0, 2, 3, 1],
                                   [0, 4, 4, 1, 2, 0, 1, 2, 3, 2]])
     res = F1(results)
     self.assertAlmostEqual(res[0], 0.61)
     self.assertEqual(res[1], 1.)
開發者ID:rekonder,項目名稱:orange3,代碼行數:9,代碼來源:test_evaluation_scoring.py

示例2: compute_auc

 def compute_auc(self, actual, predicted):
     predicted = np.array(predicted).reshape(1, -1)
     probabilities = np.zeros((1, predicted.shape[1], 2))
     probabilities[0,:,1] = predicted[0]
     probabilities[0,:,0] = 1 - predicted[0]
     results = Results(
         nmethods=1, domain=Domain([], [DiscreteVariable(values='01')]),
         actual=actual, predicted=predicted)
     results.probabilities = probabilities
     return AUC(results)[0]
開發者ID:cheral,項目名稱:orange3,代碼行數:10,代碼來源:test_evaluation_scoring.py

示例3: test_F1_binary

 def test_F1_binary(self):
     results = Results(
         domain=Domain([], DiscreteVariable(name="y", values="01")),
         actual=[0, 1, 1, 1, 0, 0, 1, 0, 0, 1])
     results.predicted = np.array([[0, 1, 1, 1, 0, 0, 1, 0, 0, 1],
                                   [0, 1, 1, 1, 0, 0, 1, 1, 1, 1]])
     res = F1(results)
     self.assertEqual(res[0], 1.)
     self.assertAlmostEqual(res[1], 5 / 6)
     res_target = F1(results, target=1)
     self.assertEqual(res[0], res_target[0])
     self.assertEqual(res[1], res_target[1])
     res_target = F1(results, target=0)
     self.assertEqual(res_target[0], 1.)
     self.assertAlmostEqual(res_target[1], 3 / 4)
開發者ID:rekonder,項目名稱:orange3,代碼行數:15,代碼來源:test_evaluation_scoring.py

示例4: test_F1_target

    def test_F1_target(self):
        results = Results(
            domain=Domain([], DiscreteVariable(name="y", values="01234")),
            actual=[0, 4, 4, 1, 2, 0, 1, 2, 3, 2])
        results.predicted = np.array([[0, 1, 4, 1, 1, 0, 0, 2, 3, 1],
                                      [0, 4, 4, 1, 2, 0, 1, 2, 3, 2]])

        for target, prob in ((0, 4 / 5),
                             (1, 1 / 3),
                             (2, 1 / 2),
                             (3, 1.),
                             (4, 2 / 3)):
            res = F1(results, target=target)
            self.assertEqual(res[0], prob)
            self.assertEqual(res[1], 1.)
開發者ID:rekonder,項目名稱:orange3,代碼行數:15,代碼來源:test_evaluation_scoring.py

示例5: test_precision_binary

 def test_precision_binary(self):
     results = Results(
         domain=Domain([], DiscreteVariable(name="y", values="01")),
         actual=[0, 1, 1, 1, 0, 0, 1, 0, 0, 1])
     results.predicted = np.array([[0, 1, 1, 1, 0, 0, 1, 0, 0, 1],
                                   [0, 1, 1, 1, 0, 0, 1, 1, 1, 0]])
     res = self.score(results)
     self.assertEqual(res[0], 1.)
     self.assertAlmostEqual(res[1], 4 / 6)
     res_target = self.score(results, target=1)
     self.assertEqual(res[0], res_target[0])
     self.assertEqual(res[1], res_target[1])
     res_target = self.score(results, target=0)
     self.assertEqual(res_target[0], 1.)
     self.assertAlmostEqual(res_target[1], 3 / 4)
     res_target = self.score(results, average='macro')
     self.assertEqual(res_target[0], 1.)
     self.assertAlmostEqual(res_target[1], (4 / 6 + 3 / 4) / 2)
開發者ID:astaric,項目名稱:orange3,代碼行數:18,代碼來源:test_evaluation_scoring.py

示例6: test_precision_multiclass

    def test_precision_multiclass(self):
        results = Results(
            domain=Domain([], DiscreteVariable(name="y", values="01234")),
            actual=[0, 4, 4, 1, 2, 0, 1, 2, 3, 2])
        results.predicted = np.array([[0, 4, 4, 1, 2, 0, 1, 2, 3, 2],
                                      [0, 1, 4, 1, 1, 0, 0, 2, 3, 1]])
        res = self.score(results, average='weighted')
        self.assertEqual(res[0], 1.)
        self.assertAlmostEqual(res[1], 0.78333, 5)

        for target, prob in ((0, 2 / 3),
                             (1, 1 / 4),
                             (2, 1 / 1),
                             (3, 1 / 1),
                             (4, 1 / 1)):
            res = self.score(results, target=target, average=None)
            self.assertEqual(res[0], 1.)
            self.assertEqual(res[1], prob)
開發者ID:astaric,項目名稱:orange3,代碼行數:18,代碼來源:test_evaluation_scoring.py

示例7: test_init

    def test_init(self):
        res = Results(nmethods=2, nrows=100)
        res.actual[:50] = 0
        res.actual[50:] = 1
        res.predicted = np.vstack((res.actual, res.actual))
        np.testing.assert_almost_equal(CA(res), [1, 1])

        res.predicted[0][0] = 1
        np.testing.assert_almost_equal(CA(res), [0.99, 1])

        res.predicted[1] = 1 - res.predicted[1]
        np.testing.assert_almost_equal(CA(res), [0.99, 0])
開發者ID:rekonder,項目名稱:orange3,代碼行數:12,代碼來源:test_evaluation_scoring.py


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