Package weka.core

Examples of weka.core.Instances.randomize()


    train.compactify();
    test.compactify();
   
    // randomize the final sets
    train.randomize(rand);
    test.randomize(rand);
  } else {
   
    // Numeric target
    int trainSize =
      Utils.probRound(runInstances.numInstances() * m_TrainPercent / 100, rand);
View Full Code Here


    Instances[] testData = new Instances[m_numFolds];
    LFSMethods[] searchResults = new LFSMethods[m_numFolds];

    Random random = new Random(m_seed);
    Instances dataCopy = new Instances(data);
    dataCopy.randomize(random);

    if (dataCopy.classAttribute().isNominal()) {
      dataCopy.stratify(m_numFolds);
    }
View Full Code Here

    double minC=0, maxC=0;

    /** Resampling  **/
    if(Double.parseDouble(m_resamplePercent.getText())<100) {
        inst = new Instances(m_data, 0, m_data.numInstances());
        inst.randomize( new Random(Integer.parseInt(m_rseed.getText())) );
       
        //System.err.println("gettingPercent: " +
        //                   Math.round(
        //                     Double.parseDouble(m_resamplePercent.getText())
        //                     / 100D * m_data.numInstances()
 
View Full Code Here

      return;
    }

    Random random = new Random(m_Seed);
    Instances cvData = new Instances(data);
    cvData.randomize(random);
    cvData = new Instances(cvData,0,(int)(cvData.numInstances()*m_SizePer)-1);
    cvData.stratify(m_numFoldsPruning);

    double[][] alphas = new double[m_numFoldsPruning][];
    double[][] errors = new double[m_numFoldsPruning][];
View Full Code Here

      m_foldThread = new Thread() {
    public void run() {
      boolean errorOccurred = false;
      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(Messages.getInstance().getString("CrossValidationFoldMaker_AcceptDataSet_LogMessage_Text_First") + getCustomName() + Messages.getInstance().getString("CrossValidationFoldMaker_AcceptDataSet_LogMessage_Text_Second"));
View Full Code Here

    // remove instances with missing class
    Instances newData = new Instances(data);
    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
View Full Code Here

    train.compactify();
    test.compactify();
   
    // randomize the final sets
    train.randomize(rand);
    test.randomize(rand);
  } else {
   
    // Numeric target
    int trainSize =
      Utils.probRound(runInstances.numInstances() * m_TrainPercent / 100, rand);
View Full Code Here

    if(m_NumAntds != -1){
      grow(data);
    }
    else{

      data.randomize(m_Random);

      // Split data into Grow and Prune    
      data.stratify(m_Folds);
 
      Instances growData=data.trainCV(m_Folds, m_Folds-1, m_Random);
View Full Code Here

  RidorRule rule = new RidorRule();                               
  rule.setPredictedClass(0);       // Predict the classes other than default
   
  for(int j = 0; j < m_Shuffle; j++){
    if(m_Shuffle > 1)
      data.randomize(m_Random);
       
    rule.buildClassifier(data);
       
    double wr, w; // Worth rate and worth
    if(m_IsAllErr){
View Full Code Here

     
      m_Antds = new FastVector()
     
      /* Split data into Grow and Prune*/
      m_Random = new Random(m_Seed);
      data.randomize(m_Random);
      data.stratify(m_Folds);
      Instances growData=data.trainCV(m_Folds, m_Folds-1, m_Random);
      Instances pruneData=data.testCV(m_Folds, m_Folds-1);
     
      grow(growData);      // Build this rule
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.