Package weka.core

Examples of weka.core.Instances.sumOfWeights()


  throw new UnsupportedClassTypeException(" Only nominal class, please.");
      if(instances.numClasses() != 2)
  throw new Exception(" Only 2 classes, please.");
     
      Instances data = new Instances(instances);
      if(Utils.eq(data.sumOfWeights(),0))
  throw new Exception(" No training data.");
     
      data.deleteWithMissingClass();
      if(Utils.eq(data.sumOfWeights(),0))
  throw new Exception(" The class labels of all the training data are missing.")
View Full Code Here


      Instances data = new Instances(instances);
      if(Utils.eq(data.sumOfWeights(),0))
  throw new Exception(" No training data.");
     
      data.deleteWithMissingClass();
      if(Utils.eq(data.sumOfWeights(),0))
  throw new Exception(" The class labels of all the training data are missing.")
     
      if(data.numInstances() < m_Folds)
  throw new Exception(" Not enough data for REP.");
     
View Full Code Here

     */   
    private void grow(Instances data){
      Instances growData = new Instances(data);
     
      m_AccuG = computeDefAccu(growData);
      m_CoverG = growData.sumOfWeights();
      /* Compute the default accurate rate of the growing data */
      double defAcRt= m_AccuG / m_CoverG;
     
      /* Keep the record of which attributes have already been used*/   
      boolean[] used=new boolean [growData.numAttributes()];
View Full Code Here

     * @param pruneData the pruning data used to prune the rule
     */   
    private void prune(Instances pruneData){
      Instances data=new Instances(pruneData);
     
      double total = data.sumOfWeights();
     
      /* The default accurate# and the the accuracy rate on pruning data */
      double defAccu=0, defAccuRate=0;
     
      int size=m_Antds.size();
View Full Code Here

      int finalSplit=split;         // Final split position
      maxInfoGain = 0;
      value = 0

      // Compute minimum number of Instances required in each split
      double minSplit =  0.1 * (data.sumOfWeights()) / 2.0;
      if (Utils.smOrEq(minSplit,m_MinNo))
  minSplit = m_MinNo;
      else if (Utils.gr(minSplit,25))
  minSplit = 25;     
     
View Full Code Here

    RipperRule finalRule;
       
    if(m_Debug)
      System.err.println("\nRule #"+position +
             "| isResidual?" + isResidual+
             "| data size: "+newData.sumOfWeights());
       
    if(isResidual){
      RipperRule newRule = new RipperRule();  
      newRule.setConsequent(classIndex);
      if(m_Debug)
View Full Code Here

     */   
    private void grow(Instances data){
      Instances growData = new Instances(data);
     
      m_AccuG = computeDefAccu(growData);
      m_CoverG = growData.sumOfWeights();
      /* Compute the default accurate rate of the growing data */
      double defAcRt= m_AccuG / m_CoverG;
     
      /* Keep the record of which attributes have already been used*/   
      boolean[] used=new boolean [growData.numAttributes()];
View Full Code Here

     * @param pruneData the pruning data used to prune the rule
     */   
    private void prune(Instances pruneData){
      Instances data=new Instances(pruneData);
     
      double total = data.sumOfWeights();
     
      /* The default accurate# and the the accuracy rate on pruning data */
      double defAccu=0, defAccuRate=0;
     
      int size=m_Antds.size();
View Full Code Here

      int finalSplit=split;         // Final split position
      maxInfoGain = 0;
      value = 0

      // Compute minimum number of Instances required in each split
      double minSplit =  0.1 * (data.sumOfWeights()) / 2.0;
      if (Utils.smOrEq(minSplit,m_MinNo))
  minSplit = m_MinNo;
      else if (Utils.gr(minSplit,25))
  minSplit = 25;     
     
View Full Code Here

  }
   
  // No need to be divided by the denomitor because
  // it's always the same
  double defMean = (classDstr[0][0] / whole);
  defInfo = meanSquaredError(growData, defMean) * growData.sumOfWeights();   
      }
     
      // Store the default class distribution 
      double[][] tmp = new double[2][m_NumClasses];
      for(int y=0; y < m_NumClasses; y++){
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.