Package weka.core

Examples of weka.core.Instance.weight()


  double w = (actual - p) / z;

  // Set values for instance
  Instance current = boostData.instance(i);
  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;
View Full Code Here


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

      // Select instances to train the classifier on
      Instances trainData = boostData;
      if (m_WeightThreshold < 100) {
View Full Code Here

  if(inst.isMissing(att)){
    total = x;
    break;
  }
   
  sndCover += inst.weight();
  if(m_ClassAttribute.isNominal()) // Nominal class
    snd[(int)inst.classValue()] += inst.weight();   
  else{                            // Numeric class
    sndWtSq += inst.weight() * inst.classValue() * inst.classValue();
    sndWtVl += inst.weight() * inst.classValue();
 
View Full Code Here

    break;
  }
   
  sndCover += inst.weight();
  if(m_ClassAttribute.isNominal()) // Nominal class
    snd[(int)inst.classValue()] += inst.weight();   
  else{                            // Numeric class
    sndWtSq += inst.weight() * inst.classValue() * inst.classValue();
    sndWtVl += inst.weight() * inst.classValue();
  }
      }
View Full Code Here

   
  sndCover += inst.weight();
  if(m_ClassAttribute.isNominal()) // Nominal class
    snd[(int)inst.classValue()] += inst.weight();   
  else{                            // Numeric class
    sndWtSq += inst.weight() * inst.classValue() * inst.classValue();
    sndWtVl += inst.weight() * inst.classValue();
  }
      }
     
     
View Full Code Here

  sndCover += inst.weight();
  if(m_ClassAttribute.isNominal()) // Nominal class
    snd[(int)inst.classValue()] += inst.weight();   
  else{                            // Numeric class
    sndWtSq += inst.weight() * inst.classValue() * inst.classValue();
    sndWtVl += inst.weight() * inst.classValue();
  }
      }
     
     
      // Enough Instances with known values?
View Full Code Here

      Instances missingData = new Instances(data, 0);
      for(int y=total; y < data.numInstances(); y++){     
  Instance inst = data.instance(y);
  missingData.add(inst);
  if(m_ClassAttribute.isNominal())
    missing[(int)inst.classValue()] += inst.weight();
  else{
    msingWtSq += inst.weight() * inst.classValue() * inst.classValue();
    msingWtVl += inst.weight() * inst.classValue();
  }     
      }     
View Full Code Here

  Instance inst = data.instance(y);
  missingData.add(inst);
  if(m_ClassAttribute.isNominal())
    missing[(int)inst.classValue()] += inst.weight();
  else{
    msingWtSq += inst.weight() * inst.classValue() * inst.classValue();
    msingWtVl += inst.weight() * inst.classValue();
  }     
      }     
     
      if(total == 0) return null; // Data all missing for the attribute  
View Full Code Here

  missingData.add(inst);
  if(m_ClassAttribute.isNominal())
    missing[(int)inst.classValue()] += inst.weight();
  else{
    msingWtSq += inst.weight() * inst.classValue() * inst.classValue();
    msingWtVl += inst.weight() * inst.classValue();
  }     
      }     
     
      if(total == 0) return null; // Data all missing for the attribute  
     
View Full Code Here

         data.instance(prev).value(att))){// within same value   
       
    // Move the split point
    for(int y=prev; y<split; y++){
      Instance inst = data.instance(y);
      fstCover += inst.weight(); sndCover -= inst.weight();
      if(m_ClassAttribute.isNominal()){ // Nominal class
        fst[(int)inst.classValue()] += inst.weight();
        snd[(int)inst.classValue()] -= inst.weight();
      }  
      else{                             // Numeric class
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.