0

我想在 weka 中将我的数据集随机分成两半。我该怎么做?

4

3 回答 3

3

I had same question and the answer is too simple. First, you need to randomly shuffle the order of instances with weka filter (Unsupervised-> instances) and then split data set into two parts. You can find a complete explanation at below link: http://cs-people.bu.edu/yingy/intro_to_weka.pdf

于 2014-09-10T08:02:23.430 回答
1

您可以使用过滤器中的第一个随机化数据集,使其随机化,其次使用移除百分比过滤器,首先使用 30% 进行测试并保存,然后重新使用它,但选中反转框,其他 70% 并保存它

所以你将进行测试和训练集随机化和拆分

于 2015-02-23T08:43:52.087 回答
0

我有一个想法,但没有使用 Weka 原生 api。如何使用随机数生成器?Math.random()生成从0到 的数字1

假设我们要拆分datasetset1set2

for every instance in dataset
{
    if Math.random() < 0.5
        put the instance into set1
    else
        put the instance into set2
}

我认为这种方法可能会为两个子集生成相似数量的实例。如果您想生成完全相同的数量,您可以向if-else.

希望这能给你一些启发。

于 2013-07-20T12:57:26.070 回答