Examples of stratify()


Examples of weka.core.Instances.stratify()

        m_Log.statusMessage("Randomizing instances...");
        Random random = new Random(seed);
        inst.randomize(random);
        if (inst.attribute(classIndex).isNominal()) {
    m_Log.statusMessage("Stratifying instances...");
    inst.stratify(numFolds);
        }
        for (int fold = 0; fold < numFolds;fold++) {
    m_Log.statusMessage("Creating splits for fold "
            + (fold + 1) + "...");
    Instances train = inst.trainCV(numFolds, fold, random);
View Full Code Here

Examples of weka.core.Instances.stratify()

  //Best iteration is selected only from these.
  int completedIterations = m_maxIterations;
 
  Instances allData = new Instances(m_train);
 
  allData.stratify(m_numFoldsBoosting);       

  double[] error = new double[m_maxIterations + 1]
 
  for (int i = 0; i < m_numFoldsBoosting; i++) {
      //split into training/test data in fold
View Full Code Here

Examples of weka.core.Instances.stratify()

  //of iteration everywhere in the tree.
  if (m_fastRegression && (m_fixedNumIterations < 0)) m_fixedNumIterations = tryLogistic(data);
 
  //Need to cross-validate alpha-parameter for CART-pruning
  Instances cvData = new Instances(data);
  cvData.stratify(m_numFoldsPruning);
 
  double[][] alphas = new double[m_numFoldsPruning][];
  double[][] errors = new double[m_numFoldsPruning][];
 
  for (int i = 0; i < m_numFoldsPruning; i++) {
View Full Code Here

Examples of weka.core.Instances.stratify()

    newData.deleteWithMissingClass();
   
    Random random = new Random(m_Seed);
    newData.randomize(random);
    if (newData.classAttribute().isNominal()) {
      newData.stratify(m_NumFolds);
    }

    // Create meta level
    generateMetaLevel(newData, random);
View Full Code Here

Examples of weka.core.Instances.stratify()

    case EVAL_TUNED_SPLIT:
      Instances trainData = null, evalData = null;
      Instances data = new Instances(instances);
      Random random = new Random(m_Seed);
      data.randomize(random);
      data.stratify(numFolds);
     
      // Make sure that both subsets contain at least one positive instance
      for (int subsetIndex = 0; subsetIndex < numFolds; subsetIndex++) {
        trainData = data.trainCV(numFolds, subsetIndex, random);
        evalData = data.testCV(numFolds, subsetIndex);
View Full Code Here

Examples of weka.core.Instances.stratify()

      try {
        Random random = new Random(getSeed());
        dataSet.randomize(random);
        if (dataSet.classIndex() >= 0 &&
      dataSet.attribute(dataSet.classIndex()).isNominal()) {
    dataSet.stratify(getFolds());
    if (m_logger != null) {
      m_logger.logMessage("CrossValidationFoldMaker : "
              +"stratifying data");
    }
        }
View Full Code Here

Examples of weka.core.Instances.stratify()

       m_BestClassifierOptions = m_InitOptions;
       return;
    }

    if (trainData.classAttribute().isNominal()) {
      trainData.stratify(m_NumFolds);
    }
    m_BestClassifierOptions = null;
   
    // Set up m_ClassifierOptions -- take getOptions() and remove
    // those being optimised.
View Full Code Here

Examples of weka.core.Instances.stratify()

    FastVector predictions = new FastVector();
    Instances runInstances = new Instances(data);
    Random random = new Random(m_Seed);
    runInstances.randomize(random);
    if (runInstances.classAttribute().isNominal() && (numFolds > 1)) {
      runInstances.stratify(numFolds);
    }
    int inst = 0;
    for (int fold = 0; fold < numFolds; fold++) {
      Instances train = runInstances.trainCV(numFolds, fold, random);
      Instances test = runInstances.testCV(numFolds, fold);
View Full Code Here

Examples of weka.core.Instances.stratify()

    newData.deleteWithMissingClass();
   
    Random random = new Random(m_Seed);
    newData.randomize(random);
    if (newData.classAttribute().isNominal()) {
      newData.stratify(m_NumFolds);
    }

    // Create meta level
    generateMetaLevel(newData, random);
 
View Full Code Here

Examples of weka.core.Instances.stratify()

    newData.deleteWithMissingClass();
   
    Random random = new Random(m_Seed);
    newData.randomize(random);
    if (newData.classAttribute().isNominal() && (m_NumXValFolds > 1)) {
      newData.stratify(m_NumXValFolds);
    }
    Instances train = newData;               // train on all data by default
    Instances test = newData;               // test on training data by default
    Classifier bestClassifier = null;
    int bestIndex = -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.