Package weka.core

Examples of weka.core.Instance.attribute()


  countsPointer = counts[clss];
        for(attIndex = 0; attIndex < instanceIndex.m_NumSeqAttsSet; attIndex++) {
          AIndex = instanceIndex.m_SequentialAttIndexes[attIndex];
          if (!tempInstance.isMissing(AIndex)) {
            sumForCounts = Utils.sum(countsPointer[AIndex]);
            posteriors *= ((countsPointer[AIndex][tempAttributeValues[attIndex]] + 1) / (sumForCounts + (double)tempInstance.attribute(AIndex).numValues()));
          }
        }
       
        if (posteriors > max) {
          maxIndex = clss;
View Full Code Here


      Instance newInstance = (Instance)instance.copy();
     
      // make sure that we get the right indexes set for the converted
      // string attributes when operating on a second batch of instances
      for (int i = 0; i < newInstance.numAttributes(); i++) {
        if (newInstance.attribute(i).isString() &&
            !newInstance.isMissing(i) &&
            m_AttIndices.isInRange(i)) {
          Attribute outAtt =
            getOutputFormat().attribute(newInstance.attribute(i).name());
          String inVal = newInstance.stringValue(i);
View Full Code Here

      for (int i = 0; i < newInstance.numAttributes(); i++) {
        if (newInstance.attribute(i).isString() &&
            !newInstance.isMissing(i) &&
            m_AttIndices.isInRange(i)) {
          Attribute outAtt =
            getOutputFormat().attribute(newInstance.attribute(i).name());
          String inVal = newInstance.stringValue(i);
          int outIndex = outAtt.indexOfValue(inVal);
          if (outIndex < 0) {
            newInstance.setMissing(i);
          } else {
View Full Code Here

    oldValue = getValueAt(rowIndex, columnIndex);
    type     = getType(rowIndex, columnIndex);
    index    = columnIndex - 1;
    inst     = m_Data.instance(rowIndex);
    att      = inst.attribute(index);

    // missing?
    if (aValue == null) {
      inst.setValue(index, Instance.missingValue());
    }
View Full Code Here

          }
          break;

        case Attribute.RELATIONAL:
          try {
            inst.setValue(index, inst.attribute(index).addRelation((Instances) aValue));
          }
          catch (Exception e) {
            // ignore
          }
          break;
View Full Code Here

   
    oldValue = getValueAt(rowIndex, columnIndex);
    type     = getType(rowIndex, columnIndex);
    index    = columnIndex - 1;
    inst     = m_Data.instance(rowIndex);
    att      = inst.attribute(index);
   
    // missing?
    if (aValue == null) {
      inst.setValue(index, Instance.missingValue());
    }
View Full Code Here

          }
          break;
         
        case Attribute.RELATIONAL:
          try {
            inst.setValue(index, inst.attribute(index).addRelation((Instances) aValue));
          }
          catch (Exception e) {
            // ignore
          }
          break;
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

      m_NoiseM[pos] = null;
      m_NoiseV[pos] = null;
      return before;
    }

    Instances after_relationInsts =before.attribute(1).relation().stringFreeStructure();
    Instances noises_relationInsts =before.attribute(1).relation().stringFreeStructure();

    Instances newData = m_Attributes;
    Instance after = new Instance(before.numAttributes());
    Instance noises =  new Instance(before.numAttributes());
View Full Code Here

      m_NoiseV[pos] = null;
      return before;
    }

    Instances after_relationInsts =before.attribute(1).relation().stringFreeStructure();
    Instances noises_relationInsts =before.attribute(1).relation().stringFreeStructure();

    Instances newData = m_Attributes;
    Instance after = new Instance(before.numAttributes());
    Instance noises =  new Instance(before.numAttributes());
    after.setDataset(newData);
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.