Examples of attributeStats()


Examples of weka.core.Instances.attributeStats()

      Instances toFilter = getInputFormat();
      int[] attsToDelete = new int[toFilter.numAttributes()];
      int numToDelete = 0;
      for(int i = 0; i < toFilter.numAttributes(); i++) {
  if (i==toFilter.classIndex()) continue; // skip class
  AttributeStats stats = toFilter.attributeStats(i);
  if (stats.distinctCount < 2) {
    // remove constant attributes
    attsToDelete[numToDelete++] = i;
  } else if (toFilter.attribute(i).isNominal()) {
    // remove nominal attributes that vary too much
View Full Code Here

Examples of weka.core.Instances.attributeStats()

          // if headers do not match check to see if it's
          // just the class that is different and that
          // all class values are missing
          if (testSet.numInstances() > 0) {
            if (testSet.classIndex() == m_trainingSet.classIndex() &&
                testSet.attributeStats(testSet.classIndex()).missingCount ==
                testSet.numInstances()) {
              // now check the other attributes against the training
              // structure
              boolean ok = true;
              for (int i = 0; i < testSet.numAttributes(); i++) {
View Full Code Here

Examples of weka.core.Instances.attributeStats()

          // if headers do not match check to see if it's
          // just the class that is different and that
          // all class values are missing
          if (testSet.numInstances() > 0) {
            if (testSet.classIndex() == m_trainingSet.classIndex() &&
                testSet.attributeStats(testSet.classIndex()).missingCount ==
                testSet.numInstances()) {
              // now check the other attributes against the training
              // structure
              boolean ok = true;
              for (int i = 0; i < testSet.numAttributes(); i++) {
View Full Code Here

Examples of weka.core.Instances.attributeStats()

    }
    m_FullNominalCounts = new int[instances.numAttributes()][0];
   
    m_FullMeansOrMediansOrModes = moveCentroid(0, instances, false);
    for (int i = 0; i < instances.numAttributes(); i++) {
      m_FullMissingCounts[i] = instances.attributeStats(i).missingCount;
      if (instances.attribute(i).isNumeric()) {
        if (m_displayStdDevs) {
          m_FullStdDevs[i] = Math.sqrt(instances.variance(i));
        }
        if (m_FullMissingCounts[i] == instances.numInstances()) {
View Full Code Here

Examples of weka.core.Instances.attributeStats()

        }
        if (m_FullMissingCounts[i] == instances.numInstances()) {
          m_FullMeansOrMediansOrModes[i] = Double.NaN; // mark missing as mean
        }
      } else {
        m_FullNominalCounts[i] = instances.attributeStats(i).nominalCounts;
        if (m_FullMissingCounts[i]
            > m_FullNominalCounts[i][Utils.maxIndex(m_FullNominalCounts[i])]) {
          m_FullMeansOrMediansOrModes[i] = -1; // mark missing as most common value
        }
      }
View Full Code Here

Examples of weka.core.Instances.attributeStats()

    assertNotNull(origs.nominalCounts);
   
    ((SpreadSubsample)m_Filter).setDistributionSpread(factor);
    Instances result = useFilter();
    assertEquals(m_Instances.numAttributes(), result.numAttributes());
    AttributeStats outs = result.attributeStats(1);

    // Check distributions are pretty similar
    assertNotNull(outs.nominalCounts);
    assertEquals(origs.nominalCounts.length, outs.nominalCounts.length);
    int min = outs.nominalCounts[0];
View Full Code Here

Examples of weka.core.Instances.attributeStats()

    att   = relInstances.attribute(n);
    stats = null;

    if (    att.isNumeric()
        || (att.isNominal() && att.numValues() <= m_MaxCardinality) ) {
      stats = relInstances.attributeStats(n);
      m_AttStats.put(k + "-" + i + "-" + n, stats);
    }
  }
      }
    }
View Full Code Here

Examples of weka.core.Instances.attributeStats()

    AttributeStats origs = m_Instances.attributeStats(1);
    assertNotNull(origs.nominalCounts);

    Instances result = useFilter();
    assertEquals(m_Instances.numAttributes(), result.numAttributes());
    AttributeStats outs = result.attributeStats(1);

    // Check distributions are pretty similar
    assertNotNull(outs.nominalCounts);
    assertEquals(origs.nominalCounts.length, outs.nominalCounts.length);
    for (int i = 0; i < origs.nominalCounts.length; i++) {
View Full Code Here

Examples of weka.core.Instances.attributeStats()

    assertNotNull(origs.nominalCounts);
   
    ((Resample)m_Filter).setBiasToUniformClass(1.0);
    Instances result = useFilter();
    assertEquals(m_Instances.numAttributes(), result.numAttributes());
    AttributeStats outs = result.attributeStats(1);

    // Check distributions are pretty similar
    assertNotNull(outs.nominalCounts);
    assertEquals(origs.nominalCounts.length, outs.nominalCounts.length);
    int est = (origs.totalCount - origs.missingCount) / origs.distinctCount;
View Full Code Here

Examples of weka.core.Instances.attributeStats()

      m_attStats = new AttributeStats [input.numAttributes()];
     
      for (int i = 0; i < input.numAttributes(); i++) {
  if (input.attribute(i).isNumeric() &&
      (input.classIndex() != i)) {
    m_attStats[i] = input.attributeStats(i);
  }
      }

      // Convert pending input instances
      for(int i = 0; i < input.numInstances(); 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.