Package weka.core

Examples of weka.core.Attribute.numValues()


    int k = 0;
    while ((int)instance.value(j) != m_Indices[j][k]) {
            vals[attSoFar + k] = 1;
      k++;
    }
    while (k < att.numValues() - 1) {
            vals[attSoFar + k] = 0;
      k++;
    }
  }
  attSoFar += att.numValues() - 1;
View Full Code Here


    while (k < att.numValues() - 1) {
            vals[attSoFar + k] = 0;
      k++;
    }
  }
  attSoFar += att.numValues() - 1;
      }
    }
    Instance inst = null;
    if (instance instanceof SparseInstance) {
      inst = new SparseInstance(instance.weight(), vals);
View Full Code Here

        try {
          classValueIndex = Integer.parseInt(remainder);
          classValueIndex--; // 0-based index
         
          if (classValueIndex < 0 ||
              classValueIndex > classAtt.numValues() - 1) {
            if (m_logger != null) {
              m_logger.
                logMessage("[ClassValuePicker] "
                    + statusMessagePrefix()
                    + " Class value index is out of range!" +
View Full Code Here

      if (a.name().length() > maxAttWidth) {
        maxAttWidth = m_theInstances.attribute(i).name().length();
      }
      if (a.isNominal()) {
        // check values
        for (int j = 0; j < a.numValues(); j++) {
          String val = a.value(j) + "  ";
          if (val.length() > maxAttWidth) {
            maxAttWidth = val.length();
          }
        }
View Full Code Here

          temp.append(pad(stdDev, " ", maxWidth + 1 - stdDev.length(), true));
        }
        temp.append("\n\n");
      } else {
        Attribute a = m_theInstances.attribute(i);
        for (int j = 0; j < a.numValues(); j++) {
          String val = "  " + a.value(j);
          temp.append(pad(val, " ", maxAttWidth + 1 - val.length(), false));
          for (int k = 0; k < m_num_clusters; k++) {
            DiscreteEstimator d = (DiscreteEstimator)m_model[k][i];
            String count = Utils.doubleToString(d.getCount(j), maxWidth, 4).trim();
View Full Code Here

        Attribute att = dataset.attribute( j );
        if( att.isNumeric() ) {
    v[ j ] = random.nextDouble();
  }
  else if ( att.isNominal() ) {
    v[ j ] = random.nextInt( att.numValues() );
  }
      }
      dataset.add( new Instance( 1, v ) );
    }
  }
View Full Code Here

            Attribute attr = (Attribute) enumAtt.nextElement();
            if (isMentionedIn(attr, rule.m_test)) {
        attUsed++;
        continue;
      }
            int M = attr.numValues();
            int[] covers = new int [M];
            int[] correct = new int [M];
            for (int j = 0; j < M; j++) {
        covers[j] = correct[j] = 0;
      }
View Full Code Here

      int i;

      if (attribute.isNominal()) {

  // For nominal attributes
  dist = new double[attribute.numValues()][data.numClasses()];
  for (i = 0; i < sortedIndices.length; i++) {
    Instance inst = data.instance(sortedIndices[i]);
    if (inst.isMissing(att)) {
      break;
    }
View Full Code Here

      int i;

      if (attribute.isNominal()) {

  // For nominal attributes
  sums = new double[attribute.numValues()];
        sumSquared = new double[attribute.numValues()];
  sumOfWeights = new double[attribute.numValues()];
  int attVal;
  for (i = 0; i < sortedIndices.length; i++) {
    Instance inst = data.instance(sortedIndices[i]);
View Full Code Here

      if (attribute.isNominal()) {

  // For nominal attributes
  sums = new double[attribute.numValues()];
        sumSquared = new double[attribute.numValues()];
  sumOfWeights = new double[attribute.numValues()];
  int attVal;
  for (i = 0; i < sortedIndices.length; i++) {
    Instance inst = data.instance(sortedIndices[i]);
    if (inst.isMissing(att)) {
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.