Package weka.core

Examples of weka.core.Instance.classIndex()


   */
  protected void checkMissing(Instances instances) throws Exception {
    for (int i = 0; i < instances.numInstances(); i++) {
      Instance ins = instances.instance(i);
      for (int j = 0; j < ins.numValues(); j++) {
        if (ins.index(j) != ins.classIndex())
          if (ins.isMissingSparse(j)) {
            throw new Exception("ERROR: KDTree can not deal with missing "
                + "values. Please run ReplaceMissingValues filter "
                + "on the dataset before passing it on to the KDTree.");
          }
View Full Code Here


   */
  protected void checkMissing(Instances instances) throws Exception {
    for (int i = 0; i < instances.numInstances(); i++) {
      Instance ins = instances.instance(i);
      for (int j = 0; j < ins.numValues(); j++) {
  if (ins.index(j) != ins.classIndex())
    if (ins.isMissingSparse(j)) {
      throw new Exception("ERROR: KDTree can not deal with missing "
    + "values. Please run ReplaceMissingValues filter "
    + "on the dataset before passing it on to the KDTree.");
    }
View Full Code Here

    // training iteration
    for (int i = 1; i < data.numInstances(); i++) { //for all instances
      Instance inst = data.instance(i);
      int flag =0;
      for(int w=0;w<inst.numAttributes()-1;w++){
        if(w!=inst.classIndex() && inst.isMissing(w))
          flag=flag+1;
      }
      if (!inst.classIsMissing()&&flag!=inst.numAttributes()-1) {
        inputBuffer = new FuzzyLattice( (Instance) data.instance(i), bounds);
        double[] sigma = new double[ (learnedCode.size())];
View Full Code Here

        m_instanceCount++;
  Instance inst = ce.getCurrentInstance();
  //  if (inst.attribute(inst.classIndex()).isNominal()) {
  double [] dist = ce.getClassifier().distributionForInstance(inst);
  double pred = 0;
  if (!inst.isMissing(inst.classIndex())) {
          if (m_outputInfoRetrievalStats) {
            // store predictions so AUC etc can be output.
            m_eval.evaluateModelOnceAndRecordPrediction(dist, inst);
          } else {
            m_eval.evaluateModelOnce(dist, inst);
View Full Code Here

            m_eval.evaluateModelOnce(dist, inst);
          }
  } else {
    pred = ce.getClassifier().classifyInstance(inst);
  }
  if (inst.classIndex() >= 0) {
    // need to check that the class is not missing
    if (inst.attribute(inst.classIndex()).isNominal()) {
      if (!inst.isMissing(inst.classIndex())) {
        if (m_dataPoint.length < 2) {
    m_dataPoint = new double[2];
View Full Code Here

  } else {
    pred = ce.getClassifier().classifyInstance(inst);
  }
  if (inst.classIndex() >= 0) {
    // need to check that the class is not missing
    if (inst.attribute(inst.classIndex()).isNominal()) {
      if (!inst.isMissing(inst.classIndex())) {
        if (m_dataPoint.length < 2) {
    m_dataPoint = new double[2];
    m_dataLegend.addElement("Accuracy");
    m_dataLegend.addElement("RMSE (prob)");
View Full Code Here

    pred = ce.getClassifier().classifyInstance(inst);
  }
  if (inst.classIndex() >= 0) {
    // need to check that the class is not missing
    if (inst.attribute(inst.classIndex()).isNominal()) {
      if (!inst.isMissing(inst.classIndex())) {
        if (m_dataPoint.length < 2) {
    m_dataPoint = new double[2];
    m_dataLegend.addElement("Accuracy");
    m_dataLegend.addElement("RMSE (prob)");
        }
View Full Code Here

    m_dataPoint = new double[1];
    m_dataLegend.addElement("Confidence");
        }
      }
      double primaryMeasure = 0;
      if (!inst.isMissing(inst.classIndex())) {
        primaryMeasure = 1.0 - m_eval.errorRate();
      } else {
        // record confidence as the primary measure
        // (another possibility would be entropy of
        // the distribution, or perhaps average
View Full Code Here

      m_reset = false;
    } else {
      // numeric class
      if (m_dataPoint.length < 1) {
        m_dataPoint = new double[1];
        if (inst.isMissing(inst.classIndex())) {
    m_dataLegend.addElement("Prediction");
        } else {
    m_dataLegend.addElement("RMSE");
        }
      }
View Full Code Here

    m_dataLegend.addElement("Prediction");
        } else {
    m_dataLegend.addElement("RMSE");
        }
      }
      if (!inst.isMissing(inst.classIndex())) {
        double update;
        if (!inst.isMissing(inst.classIndex())) {
    update = m_eval.rootMeanSquaredError();
        } else {
    update = pred;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.