Examples of classValue()


Examples of weka.core.Instance.classValue()

    Instances sample = getInputFormat().stringFreeStructure();
    Enumeration instanceEnum = getInputFormat().enumerateInstances();
    while(instanceEnum.hasMoreElements()) {
      Instance instance = (Instance) instanceEnum.nextElement();
      push((Instance) instance.copy());
      if ((int) instance.classValue() == minIndex) {
  sample.add(instance);
      }
    }

    // compute Value Distance Metric matrices for nominal features
View Full Code Here

Examples of weka.core.Instance.classValue()

    int[][] featureValueCountsByClass = new int[getInputFormat().classAttribute().numValues()][attr.numValues()];
    instanceEnum = getInputFormat().enumerateInstances();
    while(instanceEnum.hasMoreElements()) {
      Instance instance = (Instance) instanceEnum.nextElement();
      int value = (int) instance.value(attr);
      int classValue = (int) instance.classValue();
      featureValueCounts[value]++;
      featureValueCountsByClass[classValue][value]++;
    }
    for (int valueIndex1 = 0; valueIndex1 < attr.numValues(); valueIndex1++) {
      for (int valueIndex2 = 0; valueIndex2 < attr.numValues(); valueIndex2++) {
View Full Code Here

Examples of weka.core.Instance.classValue()

    double [] weights = new double [getInputFormat().numClasses()];
    int min = -1;
    for (int i = 0; i < getInputFormat().numInstances(); i++) {
      Instance current = getInputFormat().instance(i);
      if (current.classIsMissing() == false) {
        counts[(int)current.classValue()]++;
        weights[(int)current.classValue()]+= current.weight();
      }
    }

    // Convert from total weight to average weight
View Full Code Here

Examples of weka.core.Instance.classValue()

    int min = -1;
    for (int i = 0; i < getInputFormat().numInstances(); i++) {
      Instance current = getInputFormat().instance(i);
      if (current.classIsMissing() == false) {
        counts[(int)current.classValue()]++;
        weights[(int)current.classValue()]+= current.weight();
      }
    }

    // Convert from total weight to average weight
    for (int i = 0; i < counts.length; i++) {
View Full Code Here

Examples of weka.core.Instance.classValue()

      if (current.classIsMissing()) {
        for (int j = currentClass + 1; j < classIndices.length; j++) {
          classIndices[j] = i;
        }
        break;
      } else if (current.classValue() != currentClass) {
        for (int j = currentClass + 1; j <= current.classValue(); j++) {
          classIndices[j] = i;
        }         
        currentClass = (int) current.classValue();
      }
View Full Code Here

Examples of weka.core.Instance.classValue()

        for (int j = currentClass + 1; j < classIndices.length; j++) {
          classIndices[j] = i;
        }
        break;
      } else if (current.classValue() != currentClass) {
        for (int j = currentClass + 1; j <= current.classValue(); j++) {
          classIndices[j] = i;
        }         
        currentClass = (int) current.classValue();
      }
    }
View Full Code Here

Examples of weka.core.Instance.classValue()

        break;
      } else if (current.classValue() != currentClass) {
        for (int j = currentClass + 1; j <= current.classValue(); j++) {
          classIndices[j] = i;
        }         
        currentClass = (int) current.classValue();
      }
    }
    if (currentClass <= getInputFormat().numClasses()) {
      for (int j = currentClass + 1; j < classIndices.length; j++) {
        classIndices[j] = getInputFormat().numInstances();
View Full Code Here

Examples of weka.core.Instance.classValue()

    instance = getInputFormat().instance(i);
    if (!instance.classIsMissing() &&
        (!instance.isMissing(j))) {
      counts[(int)instance.value(j)] += instance.weight();
      avgClassValues[j][(int)instance.value(j)] +=
        instance.weight() * instance.classValue();
    }
  }
  sum = Utils.sum(avgClassValues[j]);
  totalCounts = Utils.sum(counts);
  if (Utils.gr(totalCounts, 0)) {
View Full Code Here

Examples of weka.core.Instance.classValue()

      if (j != m_ClassIndex && instances.attribute(j).isNumeric()) {
  for (int i = 0; i < instances.numInstances(); i++) {
    Instance inst = instances.instance(i);
    if (!inst.isMissing(j)) {
      if (inst.value(j) <
    m_intervalBounds[j][((int)inst.classValue()*2+1)]) {
        m_intervalBounds[j][((int)inst.classValue()*2+1)] =
    inst.value(j);
      }
      if (inst.value(j) >
    m_intervalBounds[j][((int)inst.classValue()*2+2)]) {
View Full Code Here

Examples of weka.core.Instance.classValue()

  for (int i = 0; i < instances.numInstances(); i++) {
    Instance inst = instances.instance(i);
    if (!inst.isMissing(j)) {
      if (inst.value(j) <
    m_intervalBounds[j][((int)inst.classValue()*2+1)]) {
        m_intervalBounds[j][((int)inst.classValue()*2+1)] =
    inst.value(j);
      }
      if (inst.value(j) >
    m_intervalBounds[j][((int)inst.classValue()*2+2)]) {
        m_intervalBounds[j][((int)inst.classValue()*2+2)] =
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.