【发布时间】:2014-10-10 07:47:16
【问题描述】:
我有一个单词及其频率的数据集。
我想过滤所有具有 1 个或多个属性值 > 200 的实例(例如)。
我需要类似RemoveWithValues 过滤器,但我想将它用于所有属性,而不是仅用于一个属性。
我该怎么做?
注意:我正在使用 Weka Explorer,我不是在编写代码。
【问题讨论】:
标签: filter machine-learning weka
我有一个单词及其频率的数据集。
我想过滤所有具有 1 个或多个属性值 > 200 的实例(例如)。
我需要类似RemoveWithValues 过滤器,但我想将它用于所有属性,而不是仅用于一个属性。
我该怎么做?
注意:我正在使用 Weka Explorer,我不是在编写代码。
【问题讨论】:
标签: filter machine-learning weka
RemoveWithValues() 过滤器可以通过以下方式使用:
Instances data;
RemoveWithValues filter = new RemoveWithValues();
String[] options = new String[4];
options[0] = "-C"; // Choose attribute to be used for selection
options[1] = "1"; // Attribute number
options[2] = "-S"; // Numeric value to be used for selection on numeric attribute. Instances with values smaller than given value will be selected. (default 0)
options[3] = "10"; //200. Say you want all those instances whose values for this attribute are less than 200
filter.setOptions(options);
filter.setInputFormat(data);
Instances newData = Filter.useFilter(data, filter);
所以,这是针对单个属性的。把它放在一个循环中,在每次迭代中更改 option[1] (迭代到所有属性的索引)。在这个循环中,你必须用 newData 替换数据。
【讨论】:
在 Weka Explorer 中,可以使用 RemoveWithValues 过滤器,如下所示:
如果 Weka 的此选项失败,您可以使用存储数据的电子表格/数据库的工具对数据进行预处理。
【讨论】: