当前位置: 首页>>代码示例>>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;未经允许,请勿转载。