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


Python DataSet.split方法代码示例

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


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

示例1: test_split_0

# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import split [as 别名]
 def test_split_0(self):
     dataset = DataSet([[1, 2], [3, 4], [5, 6], [7, 8]])
     first, second = dataset.split(0)
     self.assertEqual(first.num_samples(), 0)
     assert_that(first, equals_dataset([]))
     self.assertEqual(second.num_samples(), 4)
     assert_that(second, equals_dataset([[1, 2], [3, 4], [5, 6], [7, 8]]))
开发者ID:antoniograndinetti,项目名称:pml,代码行数:9,代码来源:test_model.py

示例2: test_split_random

# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import split [as 别名]
 def test_split_random(self):
     dataset = DataSet([[1, 2], [3, 4], [5, 6], [7, 8]])
     first, second = dataset.split(0.5, random=True)
     # since the split is random, can't assert that first or second 
     # contain particular rows, just the number of rows
     self.assertEqual(first.num_samples(), 2)
     self.assertEqual(second.num_samples(), 2)
开发者ID:antoniograndinetti,项目名称:pml,代码行数:9,代码来源:test_model.py

示例3: test_unequal_split

# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import split [as 别名]
 def test_unequal_split(self):
     dataset = DataSet([[1, 2], [3, 4], [5, 6], [7, 8]])
     first, second = dataset.split(0.3)
     self.assertEqual(first.num_samples(), 1)
     assert_that(first, equals_dataset([[1, 2]]))
     self.assertEqual(second.num_samples(), 3)
     assert_that(second, equals_dataset([[3, 4], [5, 6], [7, 8]]))
开发者ID:antoniograndinetti,项目名称:pml,代码行数:9,代码来源:test_model.py

示例4: test_split_labelled

# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import split [as 别名]
 def test_split_labelled(self):
     dataset = DataSet([[1, 2], [3, 4], [5, 6], [7, 8]], 
                       labels=["b", "b", "b", "a"])
     first, second = dataset.split(0.5)
     self.assertTrue(first.is_labelled())
     assert_that(first.get_labels(), equals_series({0: "b", 1: "b"}))
     self.assertTrue(second.is_labelled())
     assert_that(second.get_labels(), equals_series({2: "b", 3: "a"}))
开发者ID:antoniograndinetti,项目名称:pml,代码行数:10,代码来源:test_model.py


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