Package weka.core

Examples of weka.core.Instance.classValue()


    Instance datum = uncoverData.instance(x);
    if(m_ClassAttribute.isNumeric()){
      uncoveredWtSq += datum.weight() * datum.classValue() * datum.classValue();
      uncoveredWtVl += datum.weight() * datum.classValue();
      uncoveredWts += datum.weight();
      classDstr[0][0] -= datum.weight() * datum.classValue();
      classDstr[1][0] += datum.weight() * datum.classValue();
    }
    else{
      classDstr[0][(int)datum.classValue()] -= datum.weight();
      classDstr[1][(int)datum.classValue()] += datum.weight();
View Full Code Here


    if(m_ClassAttribute.isNumeric()){
      uncoveredWtSq += datum.weight() * datum.classValue() * datum.classValue();
      uncoveredWtVl += datum.weight() * datum.classValue();
      uncoveredWts += datum.weight();
      classDstr[0][0] -= datum.weight() * datum.classValue();
      classDstr[1][0] += datum.weight() * datum.classValue();
    }
    else{
      classDstr[0][(int)datum.classValue()] -= datum.weight();
      classDstr[1][(int)datum.classValue()] += datum.weight();
    }
View Full Code Here

      uncoveredWts += datum.weight();
      classDstr[0][0] -= datum.weight() * datum.classValue();
      classDstr[1][0] += datum.weight() * datum.classValue();
    }
    else{
      classDstr[0][(int)datum.classValue()] -= datum.weight();
      classDstr[1][(int)datum.classValue()] += datum.weight();
    }
  }        
   
  // Store class distribution of growing data
View Full Code Here

      classDstr[0][0] -= datum.weight() * datum.classValue();
      classDstr[1][0] += datum.weight() * datum.classValue();
    }
    else{
      classDstr[0][(int)datum.classValue()] -= datum.weight();
      classDstr[1][(int)datum.classValue()] += datum.weight();
    }
  }        
   
  // Store class distribution of growing data
  tmp = new double[2][m_NumClasses];
View Full Code Here

   */
  private double computeAccu(Instances data, int clas){
    double accu = 0;
    for(int i=0; i<data.numInstances(); i++){
      Instance inst = data.instance(i);
      if((int)inst.classValue() == clas)
  accu += inst.weight();
    }
    return accu;
  }
   
View Full Code Here

 
    double mSqErr=0, sum = data.sumOfWeights();
    for(int i=0; i < data.numInstances(); i++){
      Instance datum = data.instance(i);
      mSqErr += datum.weight()*
  (datum.classValue() - mean)*
  (datum.classValue() - mean);
    }  
 
    return (mSqErr / sum);
  }
View Full Code Here

    double mSqErr=0, sum = data.sumOfWeights();
    for(int i=0; i < data.numInstances(); i++){
      Instance datum = data.instance(i);
      mSqErr += datum.weight()*
  (datum.classValue() - mean)*
  (datum.classValue() - mean);
    }  
 
    return (mSqErr / sum);
  }
    
View Full Code Here

    double[] classProbs = new double[train.numClasses()];
    double totalWeight = 0, totalSumSquared = 0;
    for (int i = 0; i < train.numInstances(); i++) {
      Instance inst = train.instance(i);
      if (data.classAttribute().isNominal()) {
  classProbs[(int)inst.classValue()] += inst.weight();
  totalWeight += inst.weight();
      } else {
  classProbs[0] += inst.classValue() * inst.weight();
  totalSumSquared += inst.classValue() * inst.classValue() * inst.weight();
  totalWeight += inst.weight();
View Full Code Here

      Instance inst = train.instance(i);
      if (data.classAttribute().isNominal()) {
  classProbs[(int)inst.classValue()] += inst.weight();
  totalWeight += inst.weight();
      } else {
  classProbs[0] += inst.classValue() * inst.weight();
  totalSumSquared += inst.classValue() * inst.classValue() * inst.weight();
  totalWeight += inst.weight();
      }
    }
    m_Tree = new Tree();
View Full Code Here

      if (data.classAttribute().isNominal()) {
  classProbs[(int)inst.classValue()] += inst.weight();
  totalWeight += inst.weight();
      } else {
  classProbs[0] += inst.classValue() * inst.weight();
  totalSumSquared += inst.classValue() * inst.classValue() * inst.weight();
  totalWeight += inst.weight();
      }
    }
    m_Tree = new Tree();
    double trainVariance = 0;
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.