Package weka.core

Examples of weka.core.Instance.classValue()


        Instance instance = (Instance)enu.nextElement();
        if( instance.classIsMissing() ) {
          instancesOfClass[numClasses].add( instance );
  }
  else {
          int c = (int)instance.classValue();
          instancesOfClass[c].add( instance );
        }
      }
      // If there are not instances with a missing class, we do not need to
      // consider them
View Full Code Here


   
      double classYWeights = 0, totalWeights = 0;
      for(int j=0; j < data.numInstances(); j++){
    Instance datum = data.instance(j);
    totalWeights += datum.weight();
    if((int)datum.classValue() == y){
        classYWeights += datum.weight();
    }           
      } 
         
      // DL of default rule, no theory DL, only data DL
View Full Code Here

         m_Variance[x][y] = m_ZERO;
         m_Change[x][y] = 1.0;
         */ 

      data.add(example);
      m_Class[x] = example.classValue();
      m_Weights[x] = example.weight()
    }

    for(int z=0; z < numegs; z++)
      findWeights(z, m_Mean);
View Full Code Here

    for (int i = 0; i < insts.numClasses(); i++) {
      subsets[i] = new Instances(insts, insts.numInstances());
    }
    for (int j = 0; j < insts.numInstances(); j++) {
      Instance inst = insts.instance(j);
      subsets[(int)inst.classValue()].add(inst);
    }
    for (int i = 0; i < insts.numClasses(); i++) {
      subsets[i].compactify();
    }
View Full Code Here

    i = 0;
    while (source.hasMoreElements(instances)) {
      instance = source.nextElement(instances);
      if (m_clusterAssignments[i] >= 0) {
        counts[(int)m_clusterAssignments[i]][(int)instance.classValue()]++;
        clusterTotals[(int)m_clusterAssignments[i]]++;
      }
      i++;
    }
    numInstances = i;
View Full Code Here

  classDstr[1][j] = 0;
     
      if(m_ClassAttribute.isNominal()){     
  for(int i=0; i < growData.numInstances(); i++){
    Instance datum = growData.instance(i);
    classDstr[0][(int)datum.classValue()] += datum.weight();
  }
  defInfo = ContingencyTables.entropy(classDstr[0]);   
      }
      else{
  for(int i=0; i < growData.numInstances(); i++){
View Full Code Here

  defInfo = ContingencyTables.entropy(classDstr[0]);   
      }
      else{
  for(int i=0; i < growData.numInstances(); i++){
    Instance datum = growData.instance(i);
    classDstr[0][0] += datum.weight() * datum.classValue();
  }
   
  // No need to be divided by the denomitor because
  // it's always the same
  double defMean = (classDstr[0][0] / whole);
View Full Code Here

  growData = coverData;// Grow data size is shrinking      
   
  for(int x=0; x < uncoverData.numInstances(); x++){
    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();
    }
View Full Code Here

  growData = coverData;// Grow data size is shrinking      
   
  for(int x=0; x < uncoverData.numInstances(); x++){
    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();
    }
View Full Code Here

   
  for(int x=0; x < uncoverData.numInstances(); x++){
    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{
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.