Package weka.core

Examples of weka.core.Attribute.index()


    nodeToSplit.m_SplitValue, nodeToSplit.m_SplitString,
    nodeToSplit.m_SortedIndices, nodeToSplit.m_Weights, train);

      // if split will generate node(s) which has total weights less than m_minNumObj,
      // do not split
      int attIndex = att.index();
      if (subsetIndices[0][attIndex].length<minNumObj ||
    subsetIndices[1][attIndex].length<minNumObj) {

  nodeToSplit.makeLeaf(train);
  BFTree nextNode = (BFTree)
View Full Code Here


    m_SplitValue, m_SplitString,
    sortedIndices, weights, train);

      // if split will generate node(s) which has total weights less than m_minNumObj,
      // do not split
      int attIndex = att.index();
      if (subsetIndices[0][attIndex].length<minNumObj ||
    subsetIndices[1][attIndex].length<minNumObj) {
  makeLeaf(train);
      }
View Full Code Here

    if(att.isNumeric())
      antd = new NumericAntd(att);
    else
      antd = new NominalAntd(att);
       
    if(!used[att.index()]){
      /* Compute the best information gain for each attribute,
         it's stored in the antecedent formed by this attribute.
         This procedure returns the data covered by the antecedent*/
      Instances coveredData = computeInfoGain(growData, defAcRt,
                antd);
View Full Code Here

                  || diff > 0 || (diff == 0 && correct[val] > bestCorrect)) {

                // update the rule to use this test
                bestCorrect = correct[val];
                bestCovers = covers[val];
                test.m_attr = attr.index();
                test.m_val = val;
                rule.m_errors = bestCovers - bestCorrect;
              }
            }
          }
View Full Code Here

      if (att == null) {
        System.err.println("[FPGrowth] : WARNING - can't find attribute "
            + attName + " in the data.");
        numInTransactionsMustContainList--;
      } else {
        transactionsMustContainIndexes[att.index()] = true;
      }
    }
   
    if (numInTransactionsMustContainList == 0) {
      return data;
View Full Code Here

    Enumeration enu = instances.enumerateAttributes();   
    while (enu.hasMoreElements()) {
      Attribute attribute = (Attribute) enu.nextElement();
      if (attribute.type() != Attribute.NOMINAL) {
  m_nNonDiscreteAttribute = attribute.index();
  bHasNonNominal = true;
  //throw new UnsupportedAttributeTypeException("BayesNet handles nominal variables only. Non-nominal variable in dataset detected.");
      }
      Enumeration enum2 = instances.enumerateInstances();
      while (enum2.hasMoreElements()) {
View Full Code Here

        m_miningSchema.getFieldsAsInstances().attribute(m_offsetVariable);
      if (offsetAtt == null) {
        throw new Exception("[GeneralRegression] unable to find offset variable "
            + m_offsetVariable + " in the mining schema!");
      }
      offset = incomingInst[offsetAtt.index()];
    } else if (!Double.isNaN(m_offsetValue)) {
      offset = m_offsetValue;
    }
   
    double trials = 1;
View Full Code Here

      Attribute trialsAtt = m_miningSchema.getFieldsAsInstances().attribute(m_trialsVariable);
      if (trialsAtt == null) {
        throw new Exception("[GeneralRegression] unable to find trials variable "
            + m_trialsVariable + " in the mining schema!");
      }
      trials = incomingInst[trialsAtt.index()];
    } else if (!Double.isNaN(m_trialsValue)) {
      trials = m_trialsValue;
    }
   
    double distParam = 0;
View Full Code Here

        m_miningSchema.getFieldsAsInstances().attribute(m_offsetVariable);
      if (offsetAtt == null) {
        throw new Exception("[GeneralRegression] unable to find offset variable "
            + m_offsetVariable + " in the mining schema!");
      }
      offset = incomingInst[offsetAtt.index()];
    } else if (!Double.isNaN(m_offsetValue)) {
      offset = m_offsetValue;
    }
   
    for (int i = 0; i < r.length; i++) {
View Full Code Here

    // Compute attribute with maximum information gain.
    double[] infoGains = new double[data.numAttributes()];
    Enumeration attEnum = data.enumerateAttributes();
    while (attEnum.hasMoreElements()) {
      Attribute att = (Attribute) attEnum.nextElement();
      infoGains[att.index()] = computeInfoGain(data, att);
    }
    m_Attribute = data.attribute(Utils.maxIndex(infoGains));
   
    // Make leaf if information gain is zero.
    // Otherwise create successors.
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.