Package weka.core

Examples of weka.core.Attribute.indexOfValue()


      String targetCat = machineElement.getAttribute("targetCategory");
      if (targetCat != null && targetCat.length() > 0) {
        m_targetCategory = targetCat;
        Attribute classAtt = m_miningSchema.getFieldsAsInstances().classAttribute();
        if (classAtt.isNominal()) {
          int index = classAtt.indexOfValue(m_targetCategory);
         
          if (index < 0) {
            throw new Exception("[SupportVectorMachine] : can't find target category: "
                + m_targetCategory + " in the class attribute!");
          }
View Full Code Here


          m_targetCategoryIndex = index;
         
          // now check for the PMML 4.0 alternateTargetCategory
          String altTargetCat = machineElement.getAttribute("alternateTargetCategory");
          if (altTargetCat != null && altTargetCat.length() > 0) {
            index = classAtt.indexOfValue(altTargetCat);
            if (index < 0) {
              throw new Exception("[SupportVectorMachine] : can't find alternate target category: "
                  + altTargetCat + " in the class attribute!");
            }           
            m_localAlternateTargetCategoryIndex = index;
View Full Code Here

                  }
                } else {
                  // it is a nominal attribute in the mining schema so find
                  // the index that correponds to this value
                  Attribute att = miningSchemaI.attribute(p.m_miningSchemaIndex);
                  expOrIndex = att.indexOfValue(value);
                  if (expOrIndex == -1) {
                    throw new Exception("[GeneralRegression] unable to find PPCell value "
                                        + value + " in mining schema attribute "
                                        + att.name());
                  }
View Full Code Here

                              + paramName + " in parameter list");
        }

        if (targetCatName != null && targetCatName.length() > 0) {
          if (classAtt.isNominal() || classAtt.isString()) {
            targetCategoryIndex = classAtt.indexOfValue(targetCatName);
          } else {
            throw new Exception("[GeneralRegression] found a PCell with a named "
                                + "target category: " + targetCatName
                                + " but class attribute is numeric in "
                                + "mining schema");
View Full Code Here

          // 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

        }
       
        if (classAtt.isNumeric()) {
          m_defaultPrediction = Double.parseDouble(defaultScore);
        } else {
          if (classAtt.indexOfValue(defaultScore) < 0) {
            throw new Exception("[RuleSet] class value " + defaultScore +
                " not found!");
          }
          m_defaultPrediction = classAtt.indexOfValue(defaultScore);
        }
View Full Code Here

        } else {
          if (classAtt.indexOfValue(defaultScore) < 0) {
            throw new Exception("[RuleSet] class value " + defaultScore +
                " not found!");
          }
          m_defaultPrediction = classAtt.indexOfValue(defaultScore);
        }
      }
     
      String defaultConfidence = ruleSetNode.getAttribute("defaultConfidence");
      if (defaultConfidence != null && defaultConfidence.length() > 0) {
View Full Code Here

            throw new Exception("[TreeNode] class is numeric but unable to parse score "
                + m_scoreString + " as a number!");
          }
        } else {
          // store the index of this class value
          m_scoreIndex = classAtt.indexOfValue(m_scoreString);
         
          if (m_scoreIndex < 0) {
            throw new Exception("[TreeNode] can't find match for predicted value "
                + m_scoreString + " in class attribute!");
          }
View Full Code Here

      m_scoreString = ruleE.getAttribute("score");
      Attribute classAtt = miningSchema.getFieldsAsInstances().classAttribute();
      if (classAtt.isNumeric()) {
        m_score = Double.parseDouble(m_scoreString);
      } else {
        if (classAtt.indexOfValue(m_scoreString) < 0) {
          throw new Exception("[SimpleRule] class value " + m_scoreString +
              "does not exist in class attribute " + classAtt.name());
        }
        m_score = classAtt.indexOfValue(m_scoreString);
      }
View Full Code Here

      } else {
        if (classAtt.indexOfValue(m_scoreString) < 0) {
          throw new Exception("[SimpleRule] class value " + m_scoreString +
              "does not exist in class attribute " + classAtt.name());
        }
        m_score = classAtt.indexOfValue(m_scoreString);
      }
     
      String recordCount = ruleE.getAttribute("recordCount");
      if (recordCount != null && recordCount.length() > 0) {
        m_recordCount = Double.parseDouble(recordCount);
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.