Java weka.attributeSelection.infogainattributeval太慢。有没有加快速度的办法?

Java weka.attributeSelection.infogainattributeval太慢。有没有加快速度的办法?,java,weka,Java,Weka,我正在开发一个应用程序,其中需要动态地为一组特定实例对属性进行排序。现在,我正在使用信息增益对属性进行排名,但它有点太慢了 注意:我使用的数据集大约有50000个属性 我正在运行的代码 AttributeSelection attsel = new AttributeSelection(); InfoGainAttributeEval eval = new InfoGainAttributeEval(); Ranker search = new Ranker(); attsel.setEvalu

我正在开发一个应用程序,其中需要动态地为一组特定实例对属性进行排序。现在,我正在使用信息增益对属性进行排名,但它有点太慢了

注意:我使用的数据集大约有50000个属性

我正在运行的代码

AttributeSelection attsel = new AttributeSelection();
InfoGainAttributeEval eval = new InfoGainAttributeEval();
Ranker search = new Ranker();
attsel.setEvaluator(eval);
attsel.setSearch(search);
double[][] attrRanks = new double[data.numAttributes()][2];
try {
    attsel.SelectAttributes(data);
    attrRanks = attsel.rankedAttributes();
} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

结果表明,排名实际上相当快,但创建约30000-40000个属性对象的过程需要一段时间。我删除了那部分代码,它开始正常工作。 新代码

GainRatioAttributeEval eval = new GainRatioAttributeEval();
try{
    eval.buildEvaluator(data);
} catch(Exception e) {
    LOGGER.error("Couldn't evaluate gain ratio", e);
}
Double infogain = Double.MIN_VALUE;
ObjectNode objNode;
int k, i;
double[][] ig = new double[data.numAttributes()][2];
for(int j=0;j<data.numAttributes();j++){
    try {
        ig[j][0] = j;
        ig[j][1] = eval.evaluateAttribute(j);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        LOGGER.error("Couldn't evaluate gain ratio for empty entrezIds.",e);
    }
}
Arrays.sort(ig, new Comparator<double[]>(){
    @Override
    public int compare(double[] o1, double[] o2) {
        // TODO Auto-generated method stub
          if (o1[1] > o2[1]) {
                return -1;
            } else if (o1[1] < o2[1]) {
                return 1;
            }
                    return 0;
    }
});
//Ig is sorted array.

这可能有点过分,但如果您有Weka源代码,您可以尝试分析以确定计算时间消耗在哪里,并确定从哪里开始。50000个属性是很多数据!我确实试过了。原来内存密集型部分是属性选择类。仅使用InfoGainatTributeVal类并手动生成属性列表要快得多。非常感谢。