Package weka.core

Examples of weka.core.Attribute.index()


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

    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

      splitData(subsetIndices, subsetWeights, m_Attribute, m_SplitValue,
    m_SplitString, sortedIndices, weights, data);

      // 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(data);
      }
View Full Code Here

    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

          Attribute attr = (Attribute) attrEnum.nextElement();
          if( !attr.equals( getInputFormat().classAttribute() ) ) {
            if( attr.isNumeric() ) {
              double dif = nnArray[nn].value( attr ) - instanceI.value( attr );
              double gap = rand.nextDouble();
              values[attr.index()] = (double) (instanceI.value( attr ) + gap * dif);
            } else if( attr.isDate() ) {
              double dif = nnArray[nn].value( attr ) - instanceI.value( attr );
              double gap = rand.nextDouble();
              values[attr.index()] = (long) (instanceI.value( attr ) + gap * dif);
            } else {
View Full Code Here

              double gap = rand.nextDouble();
              values[attr.index()] = (double) (instanceI.value( attr ) + gap * dif);
            } else if( attr.isDate() ) {
              double dif = nnArray[nn].value( attr ) - instanceI.value( attr );
              double gap = rand.nextDouble();
              values[attr.index()] = (long) (instanceI.value( attr ) + gap * dif);
            } else {
              int[] valueCounts = new int[attr.numValues()];
              int iVal = (int) instanceI.value( attr );
              valueCounts[iVal]++;
              for( int nnEx = 0; nnEx < nearestNeighbors; nnEx++ ) {
View Full Code Here

                if( valueCounts[index] > max ) {
                  max = valueCounts[index];
                  maxIndex = index;
                }
              }
              values[attr.index()] = maxIndex;
            }
          }
        }
        values[sample.classIndex()] = minIndex;
        Instance synthetic = new Instance( 1.0, values );
View Full Code Here

        // ----------------------------------------------------------------------------
        // Perform Feed-Forward Selection
        // ----------------------------------------------------------------------------
        Attribute base_partition_attr = data.attribute(FeatureUtil.getFeatureKeyPrefix(BasePartitionFeature.class));
        assert(base_partition_attr != null);
        Integer base_partition_idx = base_partition_attr.index();
        assert(base_partition_idx != null);

        // Get the list of all the attributes that we are going to want to try to cluster on
        // We want to always remove the first attribute because that's the TransactionId
        List<Attribute> temp = (List<Attribute>)CollectionUtil.addAll(new ArrayList<Attribute>(), data.enumerateAttributes());
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.