Package weka.core

Examples of weka.core.Instances.attribute()


      m_previousShapeIndex = index;
     
      // Update the confusion matrix
//      double totalInstances =
      int tp = plotInstances.attribute(ThresholdCurve.TRUE_POS_NAME).index();
      int fp = plotInstances.attribute(ThresholdCurve.FALSE_POS_NAME).index();
      int tn = plotInstances.attribute(ThresholdCurve.TRUE_NEG_NAME).index();
      int fn = plotInstances.attribute(ThresholdCurve.FALSE_NEG_NAME).index();
      Instance temp = plotInstances.instance(index);
      double totalInstances = temp.value(tp) + temp.value(fp) + temp.value(tn) + temp.value(fn);
      // get the value out of the total pop field (if possible)
View Full Code Here


     
      // Update the confusion matrix
//      double totalInstances =
      int tp = plotInstances.attribute(ThresholdCurve.TRUE_POS_NAME).index();
      int fp = plotInstances.attribute(ThresholdCurve.FALSE_POS_NAME).index();
      int tn = plotInstances.attribute(ThresholdCurve.TRUE_NEG_NAME).index();
      int fn = plotInstances.attribute(ThresholdCurve.FALSE_NEG_NAME).index();
      Instance temp = plotInstances.instance(index);
      double totalInstances = temp.value(tp) + temp.value(fp) + temp.value(tn) + temp.value(fn);
      // get the value out of the total pop field (if possible)
      double requestedPopSize = totalInstances;
View Full Code Here

      // Update the confusion matrix
//      double totalInstances =
      int tp = plotInstances.attribute(ThresholdCurve.TRUE_POS_NAME).index();
      int fp = plotInstances.attribute(ThresholdCurve.FALSE_POS_NAME).index();
      int tn = plotInstances.attribute(ThresholdCurve.TRUE_NEG_NAME).index();
      int fn = plotInstances.attribute(ThresholdCurve.FALSE_NEG_NAME).index();
      Instance temp = plotInstances.instance(index);
      double totalInstances = temp.value(tp) + temp.value(fp) + temp.value(tn) + temp.value(fn);
      // get the value out of the total pop field (if possible)
      double requestedPopSize = totalInstances;
      try {
View Full Code Here

          setWriteMode(WRITE);
          //write header
          if(retrieveFile() == null || outW == null){
              // print out attribute names as first row
              for (int i = 0; i < structure.numAttributes(); i++) {
                System.out.print(structure.attribute(i).name());
                if (i < structure.numAttributes()-1) {
                    System.out.print(m_FieldSeparator);
                } else {
                    System.out.println();
                }
View Full Code Here

                }
              }
          }
          else{
              for (int i = 0; i < structure.numAttributes(); i++) {
                outW.print(structure.attribute(i).name());
                if (i < structure.numAttributes()-1) {
                    outW.print(m_FieldSeparator);
                } else {
                    outW.println();
                }
View Full Code Here

  if (trainHeader != null) {
    outBuff.append("Relation:     " + trainHeader.relationName() + '\n');
    outBuff.append("Attributes:   " + trainHeader.numAttributes() + '\n');
    if (trainHeader.numAttributes() < 100) {
      for (int i = 0; i < trainHeader.numAttributes(); i++) {
        outBuff.append("              " + trainHeader.attribute(i).name()
           + '\n');
      }
    } else {
      outBuff.append("              [list of attributes omitted]\n");
    }
View Full Code Here

  Object cval = current.get(j);
  if (cval instanceof String) {
    if (((String)cval).compareTo(m_MissingValue) == 0) {
      vals[j] = Utils.missingValue();
    } else {
      if (dataSet.attribute(j).isString()) {
        vals[j] = dataSet.attribute(j).addStringValue((String) cval);
      }
      else if (dataSet.attribute(j).isNominal()) {
        // find correct index
        Hashtable<Object,Integer> lookup = m_cumulativeStructure.get(j);
View Full Code Here

  if (cval instanceof String) {
    if (((String)cval).compareTo(m_MissingValue) == 0) {
      vals[j] = Utils.missingValue();
    } else {
      if (dataSet.attribute(j).isString()) {
        vals[j] = dataSet.attribute(j).addStringValue((String) cval);
      }
      else if (dataSet.attribute(j).isNominal()) {
        // find correct index
        Hashtable<Object,Integer> lookup = m_cumulativeStructure.get(j);
        int index = ((Integer)lookup.get(cval)).intValue();
View Full Code Here

      vals[j] = Utils.missingValue();
    } else {
      if (dataSet.attribute(j).isString()) {
        vals[j] = dataSet.attribute(j).addStringValue((String) cval);
      }
      else if (dataSet.attribute(j).isNominal()) {
        // find correct index
        Hashtable<Object,Integer> lookup = m_cumulativeStructure.get(j);
        int index = ((Integer)lookup.get(cval)).intValue();
        vals[j] = index;
      }
View Full Code Here

      }
      else {
        throw new IllegalStateException("Wrong attribute type at position " + (i+1) + "!!!");
      }
    }
  } else if (dataSet.attribute(j).isNominal()) {
    // find correct index
    Hashtable<Object,Integer> lookup = m_cumulativeStructure.get(j);
    int index = ((Integer)lookup.get(cval)).intValue();
    vals[j] = index;
  } else if (dataSet.attribute(j).isString()) {
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.