Examples of numClasses()


Examples of weka.core.Instances.numClasses()

        if ( data.attribute(i).isNominal() )
          numNominal++;
        if ( data.attribute(i).isNumeric() )
          numNumeric++;
      }
      System.err.printf( "%s\t%d\t%d\t%d\t%d\t", curArff.getName(), data.numInstances(), numNumeric, numNominal, data.numClasses() );
    

      /* We have adopted a generalization of AUC score to multiclass problems as
       * described in Provost and Domingos (CeDER Working Paper #IS-00-04, Stern
       * School of Business, New York University, 2001), computed by taking a
View Full Code Here

Examples of weka.core.Instances.numClasses()

       * described in Provost and Domingos (CeDER Working Paper #IS-00-04, Stern
       * School of Business, New York University, 2001), computed by taking a
       * weighted average over all one-vs-all binary classification problems
       * that can be derived from the multiclass problem, where weights
       * correspond to class prior probabilities. */
      double[] classProps = new double[data.numClasses()];
      for ( int i = 0; i < data.numInstances(); i++ )
        classProps[ (int) data.instance(i).classValue() ] += data.instance(i).weight();
      Utils.normalize(classProps);

      double[][] aucScore = new double[classifiers.length][numRuns];
View Full Code Here

Examples of weka.core.Instances.numClasses()

          eval.crossValidateModel(aClassifier, data, numFolds, new Random(curRun));
          long elapsedTime = System.currentTimeMillis() - millis;

          double aucSum = 0.0;
          double sumClassProps = 0;
          for (int c = 0; c < data.numClasses(); c++) {
            if (Double.isNaN(eval.areaUnderROC(c)))
              continue;
            aucSum += eval.areaUnderROC(c) * classProps[c];
            // this should sum to 1.0 in the end, as all the classes with AUC==NaN should have weight 0
            sumClassProps += classProps[c];
View Full Code Here

Examples of weka.core.Instances.numClasses()

    m_currentInstance = valSet.instance(nob);
    if (!m_currentInstance.classIsMissing()) {
      //this is where the network updating occurs, for the validation set
      resetNetwork();
      calculateOutputs();
      right += (calculateErrors() / valSet.numClasses())
        * m_currentInstance.weight();
      //note 'right' could be calculated here just using
      //the calculate output values. This would be faster.
      //be less modular
    }
View Full Code Here

Examples of weka.core.Instances.numClasses()

  m_ClassCounts = tmp2;
      }
     
      // Change the class values
      FastVector values = new FastVector(data.classAttribute().numValues());
      for (int i = 0; i < data.numClasses(); i++) {
  values.addElement(data.classAttribute().value(m_Converter[i]));
      }
      FastVector newVec = new FastVector(data.numAttributes());
      for (int i = 0; i < data.numAttributes(); i++) {
  if (i == data.classIndex()) {
View Full Code Here

Examples of weka.core.Instances.numClasses()

   
    numAtts = icopy.numAttributes();
    if (cl)
      numAtts++;
    if (dist)
      numAtts += icopy.numClasses();
    if (error)
      numAtts++;
    if (remove)
      numAtts--;
   
View Full Code Here

Examples of weka.core.Instances.numClasses()

  System.err.println(x+": "+m_Class.value(x) + " has " +
         orderedClasses[x] + " instances.");
    }
    // Iterate from less prevalent class to more frequent one
  oneClass: 
    for(int y=0; y < data.numClasses()-1; y++){ // For each class       
     
      double classIndex = (double)y;
      if(m_Debug){
  int ci = (int)classIndex;
  System.err.println("\n\nClass "+m_Class.value(ci)+"("+ci+"): "
View Full Code Here

Examples of weka.core.Instances.numClasses()

      data = rulesetForOneClass(expFPRate, data, classIndex, defDL);
    }

    // Set the default rule
    RipperRule defRule = new RipperRule();
    defRule.setConsequent((double)(data.numClasses()-1));
    m_Ruleset.addElement(defRule);
 
    RuleStats defRuleStat = new RuleStats();
    defRuleStat.setData(data);
    defRuleStat.setNumAllConds(m_Total);
View Full Code Here

Examples of weka.core.Instances.numClasses()

    // Should empty bins be deleted?
    if (m_DeleteEmptyBins) {

      // Figure out which classes are empty after discretization
      int numNonEmptyClasses = 0;
      boolean[] notEmptyClass = new boolean[newTrain.numClasses()];
      for (int i = 0; i < newTrain.numInstances(); i++) {
        if (!notEmptyClass[(int)newTrain.instance(i).classValue()]) {
          numNonEmptyClasses++;
          notEmptyClass[(int)newTrain.instance(i).classValue()] = true;
        }
View Full Code Here

Examples of weka.core.Instances.numClasses()

        }
      }
     
      // Compute new list of non-empty classes and mapping of indices
      FastVector newClassVals = new FastVector(numNonEmptyClasses);
      int[] oldIndexToNewIndex = new int[newTrain.numClasses()];
      for (int i = 0; i < newTrain.numClasses(); i++) {
        if (notEmptyClass[i]) {
          oldIndexToNewIndex[i] = newClassVals.size();
          newClassVals.addElement(newTrain.classAttribute().value(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.