Package weka.core

Examples of weka.core.Instances.classIndex()


    if (hasClass) {
      if (testRaw.classAttribute().isNumeric())
  throw new Exception("ClusterEvaluation: Class must be nominal!");

      filter = new Remove();
      ((Remove) filter).setAttributeIndices("" + (testRaw.classIndex() + 1));
      ((Remove) filter).setInvertSelection(false);
      filter.setInputFormat(testRaw);
    }
   
    i = 0;
View Full Code Here


      "Can't do class based evaluation and save clusterer");
    }
  }
  else {
    // if the dataset defines a class attribute, use it
    if (train.classIndex() != -1) {
      theClass = train.classIndex() + 1;
      System.err.println(
    "Note: using class attribute from dataset, i.e., attribute #"
    + theClass);
    }
View Full Code Here

    }
  }
  else {
    // if the dataset defines a class attribute, use it
    if (train.classIndex() != -1) {
      theClass = train.classIndex() + 1;
      System.err.println(
    "Note: using class attribute from dataset, i.e., attribute #"
    + theClass);
    }
  }
View Full Code Here

      int    n;
     
      result = super.process(data);
     
      for (i = 0; i < result.numAttributes(); i++) {
        if (i == result.classIndex())
    continue;
        if (!result.attribute(i).isNumeric())
    continue;
       
        for (n = 0; n < result.numInstances(); n++)
View Full Code Here

    Instances output = null;
    int numVectors=0;

    try {
      output = setOutputFormat();
      numVectors = (output.classIndex() < 0)
        ? output.numAttributes()
        : output.numAttributes()-1;
    } catch (Exception ex) {
    }
    //tomorrow
View Full Code Here

      throw new Exception("Filter must not alter the number of "
                          +"attributes in the data!");
    }

    // Check the class index (if set)
    if (original.classIndex() >= 0) {
      if (data.classIndex() != original.classIndex()) {
        throw new Exception("Filter must not change the class attribute!");
      }
    }
View Full Code Here

                          +"attributes in the data!");
    }

    // Check the class index (if set)
    if (original.classIndex() >= 0) {
      if (data.classIndex() != original.classIndex()) {
        throw new Exception("Filter must not change the class attribute!");
      }
    }

    // check the order
View Full Code Here

    Remove delTransform = new Remove();
    delTransform.setInvertSelection(true);
    // copy the instances
    Instances trainCopy = new Instances(m_trainInstances);
    featArray[0] = attribute;
    featArray[1] = trainCopy.classIndex();
    delTransform.setAttributeIndicesArray(featArray);
    delTransform.setInputFormat(trainCopy);
    trainCopy = Filter.useFilter(trainCopy, delTransform);
    o_Evaluation = new Evaluation(trainCopy);
    String [] oneROpts = { "-B", ""+getMinimumBucketSize()};
View Full Code Here

  }
  double w = (actual - p) / z;

  // Set values for instance
  Instance current = boostData.instance(i);
  current.setValue(boostData.classIndex(), z);
  current.setWeight(current.weight() * w);
      }
     
      // Scale the weights (helps with some base learners)
      double sumOfWeights = boostData.sumOfWeights();
View Full Code Here

      // Compute new header information
      Attribute newClass = new Attribute(newTrain.classAttribute().name(),
                                         newClassVals);
      FastVector newAttributes = new FastVector(newTrain.numAttributes());
      for (int i = 0; i < newTrain.numAttributes(); i++) {
        if (i != newTrain.classIndex()) {
          newAttributes.addElement(newTrain.attribute(i).copy());
        } else {
          newAttributes.addElement(newClass);
        }
      }
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.