Examples of indexOfValue()


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()

                  if (att.isNominal()) {
                    if (label == null) {
                      // inst.setMissing(att);
                      System.err.println("This shouldn't happen!!");
                    } else {
                      inst.setValue(att, att.indexOfValue(label));
                    }
                  } else {
                    // numeric binary attribute
                    inst.setValue(att, 1);
                  }
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

             ex.printStackTrace();
           }
         }
         else{
           //att is nominal
           if(att.isNominal() && att.indexOfValue(listval)<0)
             return null//instance not compliant
          
          
           try{
             newInstance.setValue(att, list[i].toString() );
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

            .get(entry.getKey()) != null) {
          for (Map.Entry<String, String> word : bagOfWordsData
              .getInstanceNominalWords().get(entry.getKey())
              .entrySet()) {
            Attribute wordAttr = instances.attribute(word.getKey());
            int valueIndex = wordAttr.indexOfValue(word.getValue());
            if (valueIndex == -1) {
              throw new IOException("oops! " + word);
            }
            wekaInstance.setValue(wordAttr.index(), valueIndex);
          }
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

      wekaInstance.setValue(instanceId.index(), entry.getKey()
          .doubleValue());
      // set document class
      Attribute classAttr = instances.attribute(CLASS);
      wekaInstance.setValue(classAttr.index(),
          classAttr.indexOfValue(entry.getValue()));
      // set numeric words
      if (bagOfWordsData.getInstanceNumericWords().get(entry.getKey()) != null) {
        for (Map.Entry<String, Double> word : bagOfWordsData
            .getInstanceNumericWords().get(entry.getKey())
            .entrySet()) {
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

      if (bagOfWordsData.getInstanceNominalWords().get(entry.getKey()) != null) {
        for (Map.Entry<String, String> word : bagOfWordsData
            .getInstanceNominalWords().get(entry.getKey())
            .entrySet()) {
          Attribute wordAttr = instances.attribute(word.getKey());
          int valueIndex = wordAttr.indexOfValue(word.getValue());
          if (valueIndex == -1) {
            throw new IOException("oops! " + word);
          }
          wekaInstance.setValue(wordAttr.index(), valueIndex);
        }
View Full Code Here

Examples of weka.core.Attribute.indexOfValue()

        wekaInstance.setValue(instanceId.index(), entry.getKey()
            .doubleValue());
        // set document class
        Attribute classAttr = instances.attribute(CLASS);
        wekaInstance.setValue(classAttr.index(),
            classAttr.indexOfValue(entry.getValue()));
        // set numeric words
        if (bagOfWordsData.getInstanceNumericWords()
            .get(entry.getKey()) != null) {
          for (Map.Entry<String, Double> word : bagOfWordsData
              .getInstanceNumericWords().get(entry.getKey())
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()

          // means that there were no Value elements defined in the
          // data dictionary (and hence the mining schema).
          // We add our value here.
          att.addStringValue(m_valueName);
        }
        m_valueIndex = att.indexOfValue(m_valueName);
        /*        for (int i = 0; i < att.numValues(); i++) {
          if (att.value(i).equals(m_valueName)) {
            m_valueIndex = i;
          }
          }*/
 
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.