当前位置: 首页>>代码示例>>Python>>正文


Python Results.predicted方法代码示例

本文整理汇总了Python中Orange.evaluation.Results.predicted方法的典型用法代码示例。如果您正苦于以下问题:Python Results.predicted方法的具体用法?Python Results.predicted怎么用?Python Results.predicted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orange.evaluation.Results的用法示例。


在下文中一共展示了Results.predicted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_F1_multiclass

# 需要导入模块: from Orange.evaluation import Results [as 别名]
# 或者: from Orange.evaluation.Results import predicted [as 别名]
 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,代码行数:11,代码来源:test_evaluation_scoring.py

示例2: test_init

# 需要导入模块: from Orange.evaluation import Results [as 别名]
# 或者: from Orange.evaluation.Results import predicted [as 别名]
    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,代码行数:14,代码来源:test_evaluation_scoring.py

示例3: test_F1_binary

# 需要导入模块: from Orange.evaluation import Results [as 别名]
# 或者: from Orange.evaluation.Results import predicted [as 别名]
 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,代码行数:17,代码来源:test_evaluation_scoring.py

示例4: test_F1_target

# 需要导入模块: from Orange.evaluation import Results [as 别名]
# 或者: from Orange.evaluation.Results import predicted [as 别名]
    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,代码行数:17,代码来源:test_evaluation_scoring.py

示例5: test_precision_binary

# 需要导入模块: from Orange.evaluation import Results [as 别名]
# 或者: from Orange.evaluation.Results import predicted [as 别名]
 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,代码行数:20,代码来源:test_evaluation_scoring.py

示例6: test_precision_multiclass

# 需要导入模块: from Orange.evaluation import Results [as 别名]
# 或者: from Orange.evaluation.Results import predicted [as 别名]
    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,代码行数:20,代码来源:test_evaluation_scoring.py


注:本文中的Orange.evaluation.Results.predicted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。