Package weka.core

Examples of weka.core.Instance.index()


     
      // Update weight vector to reflect change a1 and a2, if linear SVM
      if (m_KernelIsLinear) {
  Instance inst1 = m_data.instance(i1);
  for (int p1 = 0; p1 < inst1.numValues(); p1++) {
    if (inst1.index(p1) != m_data.classIndex()) {
      m_weights[inst1.index(p1)] +=
        y1 * (a1 - alph1) * inst1.valueSparse(p1);
    }
  }
  Instance inst2 = m_data.instance(i2);
View Full Code Here


      // Update weight vector to reflect change a1 and a2, if linear SVM
      if (m_KernelIsLinear) {
  Instance inst1 = m_data.instance(i1);
  for (int p1 = 0; p1 < inst1.numValues(); p1++) {
    if (inst1.index(p1) != m_data.classIndex()) {
      m_weights[inst1.index(p1)] +=
        y1 * (a1 - alph1) * inst1.valueSparse(p1);
    }
  }
  Instance inst2 = m_data.instance(i2);
  for (int p2 = 0; p2 < inst2.numValues(); p2++) {
View Full Code Here

        y1 * (a1 - alph1) * inst1.valueSparse(p1);
    }
  }
  Instance inst2 = m_data.instance(i2);
  for (int p2 = 0; p2 < inst2.numValues(); p2++) {
    if (inst2.index(p2) != m_data.classIndex()) {
      m_weights[inst2.index(p2)] +=
        y2 * (a2 - alph2) * inst2.valueSparse(p2);
    }
  }
      }
View Full Code Here

    }
  }
  Instance inst2 = m_data.instance(i2);
  for (int p2 = 0; p2 < inst2.numValues(); p2++) {
    if (inst2.index(p2) != m_data.classIndex()) {
      m_weights[inst2.index(p2)] +=
        y2 * (a2 - alph2) * inst2.valueSparse(p2);
    }
  }
      }
     
View Full Code Here

              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

              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

    // Get counts
    for (int k = 0; k < numInstances; k++) {
      Instance inst = data.instance(k);
      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();
View Full Code Here

      Instance inst = data.instance(k);
      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();
View Full Code Here

        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()] -=
                inst.weight();
View Full Code Here

            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()] -=
                inst.weight();
            } else {
              counts[inst.index(i)][data.attribute(inst.index(i)).numValues()]
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.