Package weka.core

Examples of weka.core.Instances.sumOfWeights()


                       
                    }
                }
               
                //Scale the weights
                weightSum = instancesCopy.sumOfWeights();
                for (int i = 0; i < instancesCopy.numInstances(); i++) {
                    Instance current = instancesCopy.instance(i);
                    current.setWeight(current.weight() * (double)instancesCopy.numInstances() / weightSum);
                }
            }
View Full Code Here


  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

    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

     *                 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

    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

                       
                    }
                }
               
                //Scale the weights
                weightSum = instancesCopy.sumOfWeights();
                for (int i = 0; i < instancesCopy.numInstances(); i++) {
                    Instance current = instancesCopy.instance(i);
                    current.setWeight(current.weight() * (double)instancesCopy.numInstances() / weightSum);
                }
            }
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.