Package weka.core

Examples of weka.core.Instance.weight()


      }
    
    } else {
      // nominal attribute
      m_counts[j][(int)inst.value(j)][(int)inst.classValue()] +=
        inst.weight();;
    }
  }
      }
    }
  }
View Full Code Here


      for (int i = 0; i < train.numInstances(); i++) {
  Instance currentInst = train.instance(i);
  if (!currentInst.classIsMissing()) {
    addNumericTrainClass(currentInst.classValue(),
        currentInst.weight());
  }
      }

    } else {
      for (int i = 0; i < m_NumClasses; i++) {
View Full Code Here

              counts[inst.index(i)][0][(int)inst.classValue()] -=
                inst.weight();
            } else {
              counts[inst.index(i)][data.attribute(inst.index(i)).numValues()]
                [numClasses] += inst.weight();
              counts[inst.index(i)][0][numClasses] -= inst.weight();
            }
          } else {
            counts[inst.index(i)][(int)inst.valueSparse(i)]
              [(int)inst.classValue()] += inst.weight();
            counts[inst.index(i)][0][(int)inst.classValue()] -= inst.weight();
View Full Code Here

                [numClasses] += inst.weight();
              counts[inst.index(i)][0][numClasses] -= inst.weight();
            }
          } else {
            counts[inst.index(i)][(int)inst.valueSparse(i)]
              [(int)inst.classValue()] += inst.weight();
            counts[inst.index(i)][0][(int)inst.classValue()] -= inst.weight();
          }
        }
      }
    }
View Full Code Here

              counts[inst.index(i)][0][numClasses] -= inst.weight();
            }
          } else {
            counts[inst.index(i)][(int)inst.valueSparse(i)]
              [(int)inst.classValue()] += inst.weight();
            counts[inst.index(i)][0][(int)inst.classValue()] -= inst.weight();
          }
        }
      }
    }
View Full Code Here

      double expFPRate = orderedClasses[y] / all;     
   
      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();
    }           
      } 
         
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
      double defDL;
View Full Code Here

    if (instances.attribute(attIndex).isNumeric()) {
      result = found = 0;
      for (int j = 0; j < numInst; j++) {
  Instance currInst = instances.instance(instList[j]);
  if (!currInst.isMissing(attIndex)) {
    found += currInst.weight();
    result += currInst.weight() *
      currInst.value(attIndex);
  }
      }
      if (Utils.eq(found, 0)) {
View Full Code Here

      result = found = 0;
      for (int j = 0; j < numInst; j++) {
  Instance currInst = instances.instance(instList[j]);
  if (!currInst.isMissing(attIndex)) {
    found += currInst.weight();
    result += currInst.weight() *
      currInst.value(attIndex);
  }
      }
      if (Utils.eq(found, 0)) {
  return 0;
View Full Code Here

    } else if (instances.attribute(attIndex).isNominal()) {
      counts = new int[instances.attribute(attIndex).numValues()];
      for (int j = 0; j < numInst; j++) {
  Instance currInst = instances.instance(instList[j]);
  if (!currInst.isMissing(attIndex)) {
    counts[(int) currInst.value(attIndex)] += currInst.weight();
  }
      }
      return (double)Utils.maxIndex(counts);
    } else {
      return 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.