Package weka.core

Examples of weka.core.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.missingCount == toFilter.numInstances()) {
          attsToDelete[numToDelete++] = i;
        } else if (stats.distinctCount < 2) {
    // remove constant attributes
    attsToDelete[numToDelete++] = i;
View Full Code Here


    data.deleteWithMissingClass();

    // Exceptions statements
    for (int i = 0; i < data.numAttributes(); i++) {
      if (i != data.classIndex()) {
        AttributeStats stats = data.attributeStats(i);
        if(data.numInstances()==stats.missingCount ||
           Double.isNaN(stats.numericStats.min) ||
           Double.isInfinite(stats.numericStats.min))
          throw new Exception("All values are missing!" +
              data.attribute(i).toString());
View Full Code Here

    // Initialize minmax stats
    bounds = new FuzzyLattice(data.numAttributes() - 1);
    int k = 0;
    for (int i = 0; i < data.numAttributes(); i++) {
      if (i != data.classIndex()) {
        AttributeStats stats = data.attributeStats(i);
        bounds.setMin(k, stats.numericStats.min);
        bounds.setMax(k, stats.numericStats.max);
        k = k + 1;
      } //if
    } //for
View Full Code Here

   *
   * @param index  the index of the attribute
   */
  protected void setDerived(int index) {
   
    AttributeStats as = m_AttributeStats[index];
    long percent = Math.round(100.0 * as.missingCount / as.totalCount);
    m_MissingLab.setText("" + as.missingCount + " (" + percent + "%)");
    percent = Math.round(100.0 * as.uniqueCount / as.totalCount);
    m_UniqueLab.setText("" + as.uniqueCount + " (" + percent + "%)");
    m_DistinctLab.setText("" + as.distinctCount);
View Full Code Here

    *
    * @param inst the Instances to determine the values from which are kept 
    */
   public void determineValues(Instances inst) {
      int          i;
      AttributeStats    stats;
      int          attIdx;
      int          min;
      int          max;
      int          count;

View Full Code Here

      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

    int removeCount = 0;
    boolean first = true;
    int maxCount = 0;
   
    for (int i=0;i<instances.numAttributes();i++) {
      AttributeStats as = instances.attributeStats(i);
      if (m_upperBoundMinSupport == 1.0 && maxCount != numInstances) {
  // see if we can decrease this by looking for the most frequent value
  int [] counts = as.nominalCounts;
  if (counts[Utils.maxIndex(counts)] > maxCount) {
    maxCount = counts[Utils.maxIndex(counts)];
View Full Code Here

    int      k;
    int      l;
    int      i;
    int      n;
    int      m;
    AttributeStats  stats;
    Attribute    att;
   
    result = getOutputFormat();

    // initialize attribute statistics
View Full Code Here

             boolean delete) {

      if (m_attStats == null) {
  m_attStats = new AttributeStats[m_numAttributes];
  for (int i = 0; i < m_numAttributes; i++) {
    m_attStats[i] = new AttributeStats();
    if (m_clusterInstances.attribute(i).isNominal()) {
      m_attStats[i].nominalCounts =
        new int [m_clusterInstances.attribute(i).numValues()];
    } else {
      m_attStats[i].numericStats = new Stats();
View Full Code Here

    // remove instances with missing class
    instances = new Instances(instances);
    instances.deleteWithMissingClass();
   
    AttributeStats stats = instances.attributeStats(instances.classIndex());
    if (m_manualThreshold) {
      m_BestThreshold = m_manualThresholdValue;
    } else {
      m_BestThreshold = 0.5;
    }
View Full Code Here

TOP

Related Classes of weka.core.AttributeStats

Copyright © 2018 www.massapicom. 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.