Examples of sumOfWeights()


Examples of weka.core.Instances.sumOfWeights()

    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

Examples of weka.core.Instances.sumOfWeights()

  }
   
  // 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

Examples of weka.core.Instances.sumOfWeights()

 
    /* Calculate accuracy parameters for all the antecedents in this rule */
    for(int x=0; x<size; x++){
      Antd antd=(Antd)m_Antds.elementAt(x);
      Instances newData = new Instances(data);
      if(Utils.eq(newData.sumOfWeights(),0.0))
  break;
     
      data = new Instances(newData, newData.numInstances()); // Make data empty
     
      for(int y=0; y<newData.numInstances(); y++){
View Full Code Here

Examples of weka.core.Instances.sumOfWeights()

      public void grow(Instances data) throws Exception {
      if(m_Consequent == -1)
  throw new Exception(" Consequent not set yet.");
     
      Instances growData = data;          
      double sumOfWeights = growData.sumOfWeights();
      if(!Utils.gr(sumOfWeights, 0.0))
  return;
     
      /* Compute the default accurate rate of the growing data */
      double defAccu = computeDefAccu(growData);
View Full Code Here

Examples of weka.core.Instances.sumOfWeights()

     *                 the whole pruning data instead of the data covered
     */   
    public void prune(Instances pruneData, boolean useWhole){
  Instances data = pruneData;
 
      double total = data.sumOfWeights();
      if(!Utils.gr(total, 0.0))
  return;
 
      /* The default accurate # and rate on pruning data */
      double defAccu=computeDefAccu(data);
View Full Code Here

Examples of weka.core.Instances.sumOfWeights()

  current.setValue(boostData.classIndex(), z);
  current.setWeight(current.weight() * w);
      }
     
      // Scale the weights (helps with some base learners)
      double sumOfWeights = boostData.sumOfWeights();
      double scalingFactor = (double)origSumOfWeights / sumOfWeights;
      for (int i = 0; i < probs.length; i++) {
  Instance current = boostData.instance(i);
  current.setWeight(current.weight() * scalingFactor);
      }
View Full Code Here

Examples of weka.core.Instances.sumOfWeights()

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

Examples of weka.core.Instances.sumOfWeights()

    int numCl = data.numClasses();
    m_Root = new Ridor_node();
    m_Class = instances.classAttribute();     // The original class label
 
    int index = data.classIndex();
    m_Cover = data.sumOfWeights();

    m_Random = new Random(m_Seed);
 
    /* Create a binary attribute */
    FastVector binary_values = new FastVector(2);
View Full Code Here

Examples of weka.core.Instances.sumOfWeights()

        }
     
      data.setClassIndex(index);           // Position new class label
     
      /* Build a set of rules */
      double classCount = data.sumOfWeights() - isPure[i];
      Vector ruleset = new Vector();
      double wAcRt = buildRuleset(data, classCount, ruleset);
     
      if(Utils.gr(wAcRt, maxAcRt)){
        finalRules = ruleset;
View Full Code Here

Examples of weka.core.Instances.sumOfWeights()

     */
    private double buildRuleset(Instances insts, double classCount, Vector ruleset)
      throws Exception {     
      Instances data = new Instances(insts);
      double wAcRt = 0// The weighted accuracy rate of this ruleset
      double total = data.sumOfWeights();
     
      while( classCount >= m_Folds ){      // Data is not pure
  RidorRule bestRule = null;
  double bestWorthRate= -1;        // The best worth achieved by
  double bestWorth = -1;           // randomization of the data
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.