Package weka.core

Examples of weka.core.Instances.classIndex()


        int[] indicesSparse = smo.sparseIndices()[0][1];
        double[] weights = new double[trainCopy.numAttributes()];
        for (int j = 0; j < weightsSparse.length; j++) {
          weights[indicesSparse[j]] = weightsSparse[j] * weightsSparse[j];
        }
        weights[trainCopy.classIndex()] = Double.MAX_VALUE;
        int minWeightIndex;
        int[] featArray = new int[numToElim];
        boolean[] eliminated = new boolean[origIndices.length];
        for (int j = 0; j < numToElim; j++) {
          minWeightIndex = Utils.minIndex(weights);
View Full Code Here


        //notifyInstanceListeners(e);
  //  Instances dataset = e.getInstance().dataset();
  Instances dataset = e.getStructure();
  if (m_Filter instanceof SupervisedFilter) {
    // defualt to last column if no class is set
    if (dataset.classIndex() < 0) {
      dataset.setClassIndex(dataset.numAttributes()-1);
    }
  }
  // initialize filter
  m_Filter.setInputFormat(dataset);
View Full Code Here

   
    int numCl = data.numClasses();
    m_Root = new Ridor_node();
    m_Class = instances.classAttribute();     // The original class label
 
    int index = data.classIndex();
    m_Cover = data.sumOfWeights();
 
    /* Create a binary attribute */
    FastVector binary_values = new FastVector(2);
    binary_values.addElement("otherClasses");
View Full Code Here

      double total = Utils.sum(isPure);  
     
      if(m_IsMajority){
  defClass = (double)Utils.maxIndex(isPure);
  Instances data = new Instances(dataByClass[(int)defClass]);
  int index = data.classIndex();
   
  for(int j=0; j<data.numInstances(); j++)
    data.instance(j).setClassValue(1);       // Set one class as default
   
  for(int k=0; k < dataByClass.length; k++)    // Merge into one dataset
View Full Code Here

   
  // Find default class
  for(int i=0; i < dataByClass.length; i++){
    if(isPure[i] >= m_Folds){
      Instances data = new Instances(dataByClass[i]);
      int index = data.classIndex();
     
      for(int j=0; j<data.numInstances(); j++)
        data.instance(j).setClassValue(1);       // Set one class as default
     
      for(int k=0; k < dataByClass.length; k++)    // Merge into one dataset
View Full Code Here

    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

      File currentFile = (File) getDatasets().elementAt(m_DatasetNumber);
      AbstractFileLoader loader = ConverterUtils.getLoaderForFile(currentFile);
      loader.setFile(currentFile);
      Instances data = new Instances(loader.getDataSet());
      // only set class attribute if not already done by loader
      if (data.classIndex() == -1) {
  if (m_ClassFirst) {
    data.setClassIndex(0);
  } else {
    data.setClassIndex(data.numAttributes() - 1);
  }
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.