Examples of classValue()


Examples of weka.core.Instance.classValue()

    }
 
    for (int i = 0; i < nC; i++) {
      // initialize X[][]
      Instance current = train.instance(i);
      Y[i] = (int)current.classValue()// Class value starts from 0
      weights[i] = current.weight();     // Dealing with weights
      totWeights += weights[i];
     
      m_Data[i][0] = 1;
      int j = 1;
View Full Code Here

Examples of weka.core.Instance.classValue()

      int m = Array.getLength(x);
     
      if (m > 0)
        max_index = Math.max(max_index, ((Integer) getField(Array.get(x, m - 1), "index")).intValue());
      vx.addElement(x);
      vy.addElement(new Double(inst.classValue()));
    }
   
    // calculate actual gamma
    if (getGamma() == 0)
      m_GammaActual = 1.0 / max_index;
View Full Code Here

Examples of weka.core.Instance.classValue()

    for (int it = 0; it < m_NumIterations; it++) {
      for (int i = 0; i < m_Train.numInstances(); i++) {
  Instance inst = m_Train.instance(i);
  if (!inst.classIsMissing()) {
    int prediction = makePrediction(m_K, inst);
    int classValue = (int) inst.classValue();
    if (prediction == classValue) {
      m_Weights[m_K]++;
    } else {
      m_IsAddition[m_K] = (classValue == 1);
      m_Additions[m_K] = i;
View Full Code Here

Examples of weka.core.Instance.classValue()

    // In case some one use this routine in testing,
    // although he/she should not do so
    if(m_Converter != null){
      Instance datum = (Instance)instance.copy();
      if (!datum.isMissing(m_ClassAttribute)){
  datum.setClassValue((double)m_Converter[(int)datum.classValue()]);
      }
      push(datum);
      return true;
    }
   
View Full Code Here

Examples of weka.core.Instance.classValue()

      // Process all instances
      for(int xyz=0; xyz<data.numInstances(); xyz++){
  Instance datum = data.instance(xyz);
  if (!datum.isMissing(datum.classIndex())) {
    datum.setClassValue((double)m_Converter[(int)datum.classValue()]);
  }
  push(datum);
      }
    }
    flushInput();
View Full Code Here

Examples of weka.core.Instance.classValue()

      }

      // 3. error flag?
      if (getOutputErrorFlag()) {
  if (result.classAttribute().isNominal()) {
    if (oldInstance.classValue() == m_ActualClassifier.classifyInstance(oldInstance))
      newValues[start] = 0;
    else
      newValues[start] = 1;
  }
  else {
View Full Code Here

Examples of weka.core.Instance.classValue()

      newValues[start] = 0;
    else
      newValues[start] = 1;
  }
  else {
    newValues[start] = m_ActualClassifier.classifyInstance(oldInstance) - oldInstance.classValue();
  }
  start++;
      }

      // create new instance
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
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.