Examples of indexOfValue()


Examples of weka.core.Attribute.indexOfValue()

    protected ScoreDistribution(Element scoreE, MiningSchema miningSchema, double baseCount)
      throws Exception {
      // get the label
      m_classLabel = scoreE.getAttribute("value");
      Attribute classAtt = miningSchema.getFieldsAsInstances().classAttribute();
      if (classAtt == null || classAtt.indexOfValue(m_classLabel) < 0) {
        throw new Exception("[ScoreDistribution] class attribute not set or class value " +
            m_classLabel + " not found!");
      }
     
      m_classLabelIndex = classAtt.indexOfValue(m_classLabel);
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

      if (classAtt == null || classAtt.indexOfValue(m_classLabel) < 0) {
        throw new Exception("[ScoreDistribution] class attribute not set or class value " +
            m_classLabel + " not found!");
      }
     
      m_classLabelIndex = classAtt.indexOfValue(m_classLabel);
     
      // get the frequency
      String recordC = scoreE.getAttribute("recordCount");
      m_recordCount = Double.parseDouble(recordC);
     
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

        String valueS = simpleP.getAttribute("value");
        if (att.isNumeric()) {
          m_value = Double.parseDouble(valueS);
        } else {
          m_nominalValue = valueS;
          m_value = att.indexOfValue(valueS);
          if (m_value < 0) {
            throw new Exception("[SimplePredicate] can't find value " + valueS + " in nominal " +
                "attribute " + att.name());
          }
        }
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

          }
        }
      }
    } else {
      // treat the string as the label to look for
      classValueIndex = classAtt.indexOfValue(m_classValue.trim());
    }
   
    if (classValueIndex < 0) {
      return null; // error
    }
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

            // ignore
          }
          break;
     
        case Attribute.NOMINAL:
          if (att.indexOfValue(tmp) > -1)
            inst.setValue(index, att.indexOfValue(tmp));
          break;
     
        case Attribute.STRING:
          inst.setValue(index, tmp);
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

          }
          break;
     
        case Attribute.NOMINAL:
          if (att.indexOfValue(tmp) > -1)
            inst.setValue(index, att.indexOfValue(tmp));
          break;
     
        case Attribute.STRING:
          inst.setValue(index, tmp);
          break;
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

      Attribute oldAtt = instanceInfo.attribute(m_AttIndex.getIndex());
      int [] selection = new int[m_Values.size()];
      Iterator iter = m_Values.iterator();
      int i = 0;
      while (iter.hasNext()) {
         selection[i] = oldAtt.indexOfValue(iter.next().toString());
         i++;
      }
      FastVector newVals = new FastVector();
      for (i = 0; i < selection.length; i++) {
         newVals.addElement(oldAtt.value(selection[i]));
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

            !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 {
            newInstance.setValue(i, outIndex);
          }
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

    double newVal = value;
    if (m_missingValueTreatmentMethod != Missing.ASIS &&
        Utils.isMissingValue(value)) {
      if (m_missingValueReplacementNominal != null) {
        Attribute att = m_miningSchemaI.attribute(m_index);
        int valIndex = att.indexOfValue(m_missingValueReplacementNominal);
        if (valIndex < 0) {
          throw new Exception("[MiningSchema] Nominal missing value replacement value doesn't "
                              + "exist in the mining schema Instances!");
        }
        newVal = valIndex;
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

    Attribute temp = new Attribute(att.name(), newVals);

    Instance newInstance = (Instance)instance.copy();   
    if (!newInstance.isMissing(m_AttIndex.getIndex())) {
      String currValue = newInstance.stringValue(m_AttIndex.getIndex());
      if(temp.indexOfValue(currValue) == -1)
  newInstance.setValue(m_AttIndex.getIndex(), temp.indexOfValue(m_Label));
      else
  newInstance.setValue(m_AttIndex.getIndex(), temp.indexOfValue(currValue));
    }
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.