Example usage for weka.classifiers.trees M5P classifyInstance

List of usage examples for weka.classifiers.trees M5P classifyInstance

Introduction

In this page you can find the example usage for weka.classifiers.trees M5P classifyInstance.

Prototype

@Override
public double classifyInstance(Instance inst) throws Exception 

Source Link

Document

Calculates a prediction for an instance using a set of rules or an M5 model tree

Usage

From source file:cn.ict.zyq.bestConf.COMT2.COMT2.java

License:Open Source License

private static double computeOmegaDelta(M5P model, M5P modelPi, Instances omega) throws Exception {
    double retval = 0., y;
    Enumeration<Instance> enu = omega.enumerateInstances();
    int idxClass = omega.classIndex();
    Instance ins;/*from   www  . j  a  va2  s. c om*/
    while (enu.hasMoreElements()) {
        ins = enu.nextElement();
        y = ins.value(idxClass);
        retval += Math.pow(y - model.classifyInstance(ins), 2) - Math.pow(y - modelPi.classifyInstance(ins), 2);
    }
    return retval;
}