Package weka.core

Examples of weka.core.Instance.weight()


    if(m_ClassAttribute.isNominal()){ // Nominal class     
      stats[v][(int)inst.classValue()] += inst.weight();
      all[(int)inst.classValue()] += inst.weight();     
    }
    else{                             // Numeric class
      wSq[v] += inst.weight() * inst.classValue() * inst.classValue();
      wVl[v] += inst.weight() * inst.classValue();
      totalWS += inst.weight() * inst.classValue() * inst.classValue();
      totalWV += inst.weight() * inst.classValue();
    }
  }
View Full Code Here


    // Initialize counters
    double[] temp = new double[numClasses + 1];
    for (int k = 0; k < numInstances; k++) {
      Instance inst = data.instance(k);
      if (inst.classIsMissing()) {
        temp[numClasses] += inst.weight();
      } else {
        temp[(int)inst.classValue()] += inst.weight();
      }
    }
    for (int k = 0; k < counts.length; k++) {
View Full Code Here

      stats[v][(int)inst.classValue()] += inst.weight();
      all[(int)inst.classValue()] += inst.weight();     
    }
    else{                             // Numeric class
      wSq[v] += inst.weight() * inst.classValue() * inst.classValue();
      wVl[v] += inst.weight() * inst.classValue();
      totalWS += inst.weight() * inst.classValue() * inst.classValue();
      totalWV += inst.weight() * inst.classValue();
    }
  }
  else{
View Full Code Here

    for (int k = 0; k < numInstances; k++) {
      Instance inst = data.instance(k);
      if (inst.classIsMissing()) {
        temp[numClasses] += inst.weight();
      } else {
        temp[(int)inst.classValue()] += inst.weight();
      }
    }
    for (int k = 0; k < counts.length; k++) {
      if (k != classIndex) {
        for (int i = 0; i < temp.length; i++) {
View Full Code Here

      all[(int)inst.classValue()] += inst.weight();     
    }
    else{                             // Numeric class
      wSq[v] += inst.weight() * inst.classValue() * inst.classValue();
      wVl[v] += inst.weight() * inst.classValue();
      totalWS += inst.weight() * inst.classValue() * inst.classValue();
      totalWV += inst.weight() * inst.classValue();
    }
  }
  else{
    splitData[bag].add(inst);
View Full Code Here

    }
    else{                             // Numeric class
      wSq[v] += inst.weight() * inst.classValue() * inst.classValue();
      wVl[v] += inst.weight() * inst.classValue();
      totalWS += inst.weight() * inst.classValue() * inst.classValue();
      totalWV += inst.weight() * inst.classValue();
    }
  }
  else{
    splitData[bag].add(inst);
    if(m_ClassAttribute.isNominal()){ // Nominal class
View Full Code Here

    }
  }
  else{
    splitData[bag].add(inst);
    if(m_ClassAttribute.isNominal()){ // Nominal class
      all[(int)inst.classValue()] += inst.weight();
      missing[(int)inst.classValue()] += inst.weight();
    }
    else{                            // Numeric class
      totalWS += inst.weight() * inst.classValue() * inst.classValue();
      totalWV += inst.weight() * inst.classValue();
 
View Full Code Here

      for (int i = 0; i < inst.numValues(); i++) {
        if (inst.index(i) != classIndex) {
          if (inst.isMissingSparse(i) || inst.classIsMissing()) {
            if (!inst.isMissingSparse(i)) {
              counts[inst.index(i)][(int)inst.valueSparse(i)][numClasses] +=
                inst.weight();
              counts[inst.index(i)][0][numClasses] -= inst.weight();
            } else if (!inst.classIsMissing()) {
              counts[inst.index(i)][data.attribute(inst.index(i)).numValues()]
                [(int)inst.classValue()] += inst.weight();
              counts[inst.index(i)][0][(int)inst.classValue()] -=
View Full Code Here

  }
  else{
    splitData[bag].add(inst);
    if(m_ClassAttribute.isNominal()){ // Nominal class
      all[(int)inst.classValue()] += inst.weight();
      missing[(int)inst.classValue()] += inst.weight();
    }
    else{                            // Numeric class
      totalWS += inst.weight() * inst.classValue() * inst.classValue();
      totalWV += inst.weight() * inst.classValue();
      msingWS += inst.weight() * inst.classValue() * inst.classValue();
 
View Full Code Here

    if(m_ClassAttribute.isNominal()){ // Nominal class
      all[(int)inst.classValue()] += inst.weight();
      missing[(int)inst.classValue()] += inst.weight();
    }
    else{                            // Numeric class
      totalWS += inst.weight() * inst.classValue() * inst.classValue();
      totalWV += inst.weight() * inst.classValue();
      msingWS += inst.weight() * inst.classValue() * inst.classValue();
      msingWV += inst.weight() * inst.classValue();    
    }
  }
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.