Package weka.core

Examples of weka.core.Instance.classIndex()


    m_dataLegend.addElement("RMSE");
        }
      }
      if (!inst.isMissing(inst.classIndex())) {
        double update;
        if (!inst.isMissing(inst.classIndex())) {
    update = m_eval.rootMeanSquaredError();
        } else {
    update = pred;
        }
        m_dataPoint[0] = update;
View Full Code Here


    m_min = update;
        }
      }
     
      m_ce.setLegendText(m_dataLegend);
      m_ce.setMin((inst.isMissing(inst.classIndex())
       ? m_min
       : 0));
      m_ce.setMax(m_max);
      m_ce.setDataPoint(m_dataPoint);
      m_ce.setReset(m_reset);
View Full Code Here

            textTitle.length());
        String results = "=== Performance information ===\n\n"
    "Scheme:   " + textTitle + "\n"
    "Relation: "+ inst.dataset().relationName() + "\n\n"
    + m_eval.toSummaryString();
              if (inst.classIndex() >= 0 &&
                  inst.classAttribute().isNominal() &&
                  (m_outputInfoRetrievalStats)) {
                results += "\n" + m_eval.toClassDetailsString();
              }
View Full Code Here

                  inst.classAttribute().isNominal() &&
                  (m_outputInfoRetrievalStats)) {
                results += "\n" + m_eval.toClassDetailsString();
              }

              if (inst.classIndex() >= 0 &&
                  inst.classAttribute().isNominal()) {
                results += "\n" + m_eval.toMatrixString();
              }
        textTitle = "Results: " + textTitle;
        TextEvent te =
View Full Code Here

 
    java.util.Enumeration enumInsts = instances.enumerateInstances();
    while (enumInsts.hasMoreElements())
      {
  instance = (Instance) enumInsts.nextElement();
  classIndex = (int)instance.value(instance.classIndex());
  docsPerClass[classIndex] += instance.weight();
   
  for(int a = 0; a<instance.numValues(); a++)
    if(instance.index(a) != instance.classIndex())
      {
View Full Code Here

  instance = (Instance) enumInsts.nextElement();
  classIndex = (int)instance.value(instance.classIndex());
  docsPerClass[classIndex] += instance.weight();
   
  for(int a = 0; a<instance.numValues(); a++)
    if(instance.index(a) != instance.classIndex())
      {
        if(!instance.isMissing(a))
    {
      numOccurences = instance.valueSparse(a) * instance.weight();
      if(numOccurences < 0)
View Full Code Here

    instance = (Instance) enumInsts.nextElement();
    docClass = (int)instance.value(classIndex);
    //docsPerClass[docClass] += instance.weight();
   
    for(int a = 0; a<instance.numValues(); a++)
        if(instance.index(a) != instance.classIndex()) {
          if(!instance.isMissing(a)) {
            numOccurrences = instance.valueSparse(a) * instance.weight();
            if(numOccurrences < 0)
          throw new Exception("Numeric attribute"+
                                                  " values must all be greater"+
View Full Code Here

      m_Converter = temp;

      // 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);
      }
    }
View Full Code Here

      // out of range?
      if (!m_Cols.isInRange(i))
  continue;
     
      // skip class?
      if ( (result.classIndex() == i) && (!m_IncludeClass) )
  continue;
     
      // too small?
      if (result.value(i) < m_MinThreshold) {
  if (getDebug())
View Full Code Here

   */
  protected void checkMissing(Instances instances) throws Exception {
    for (int i = 0; i < instances.numInstances(); i++) {
      Instance ins = instances.instance(i);
      for (int j = 0; j < ins.numValues(); j++) {
        if (ins.index(j) != ins.classIndex())
          if (ins.isMissingSparse(j)) {
            throw new Exception("ERROR: KDTree can not deal with missing "
                + "values. Please run ReplaceMissingValues filter "
                + "on the dataset before passing it on to the KDTree.");
          }
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.