protected boolean[] datasetIntegrity(boolean nominalPredictor,boolean numericPredictor,boolean stringPredictor,boolean datePredictor,boolean relationalPredictor,boolean multiInstance,int classType,boolean predictorMissing,boolean classMissing){
  print("classifier doesn't alter original datasets");
  printAttributeSummary(nominalPredictor,numericPredictor,stringPredictor,datePredictor,relationalPredictor,multiInstance,classType);
  print("...");
  int numTrain=getNumInstances(), numTest=getNumInstances(), numClasses=2, missingLevel=20;
  boolean[] result=new boolean[2];
  Instances train=null;
  Instances test=null;
  Classifier classifier=null;
  Evaluation evaluation=null;
  boolean built=false;
  try {
    train=makeTestDataset(42,numTrain,nominalPredictor ? getNumNominal() : 0,numericPredictor ? getNumNumeric() : 0,stringPredictor ? getNumString() : 0,datePredictor ? getNumDate() : 0,relationalPredictor ? getNumRelational() : 0,numClasses,classType,multiInstance);
    test=makeTestDataset(24,numTest,nominalPredictor ? getNumNominal() : 0,numericPredictor ? getNumNumeric() : 0,stringPredictor ? getNumString() : 0,datePredictor ? getNumDate() : 0,relationalPredictor ? getNumRelational() : 0,numClasses,classType,multiInstance);
    if (missingLevel > 0) {
      addMissing(train,missingLevel,predictorMissing,classMissing);
      addMissing(test,Math.min(missingLevel,50),predictorMissing,classMissing);
    }
    classifier=AbstractClassifier.makeCopies(getClassifier(),1)[0];
    evaluation=new Evaluation(train);
  }
 catch (  Exception ex) {
    throw new Error("Error setting up for tests: " + ex.getMessage());
  }
  try {
    Instances trainCopy=new Instances(train);
    Instances testCopy=new Instances(test);
    classifier.buildClassifier(trainCopy);
    compareDatasets(train,trainCopy);
    built=true;
    testWRTZeroR(classifier,evaluation,trainCopy,testCopy);
    compareDatasets(test,testCopy);
    println("yes");
    result[0]=true;
  }
 catch (  Exception ex) {
    println("no");
    result[0]=false;
    if (m_Debug) {
      println("\n=== Full Report ===");
      print("Problem during");
      if (built) {
        print(" testing");
      }
 else {
        print(" training");
      }
      println(": " + ex.getMessage() + "\n");
      println("Here are the datasets:\n");
      println("=== Train Dataset ===\n" + train.toString() + "\n");
      println("=== Test Dataset ===\n" + test.toString() + "\n\n");
    }
  }
  return result;
}

protected boolean [ ] datasetIntegrity ( boolean nominalPredictor , boolean numericPredictor , boolean stringPredictor , boolean datePredictor , boolean relationalPredictor , boolean multiInstance , int classType , boolean predictorMissing , boolean classMissing ) { print ( "classifier doesn't alter original datasets" ) ; printAttributeSummary ( nominalPredictor , numericPredictor , stringPredictor , datePredictor , relationalPredictor , multiInstance , classType ) ; print ( "..." ) ; int numTrain = getNumInstances ( ) , numTest = getNumInstances ( ) , numClasses = 2 , missingLevel = 20 ; boolean [ ] result = new boolean [ 2 ] ; Instances train = null ; Instances test = null ; Classifier classifier = null ; Evaluation evaluation = null ; boolean built = false ; try { train = makeTestDataset ( 42 , numTrain , nominalPredictor ? getNumNominal ( ) : 0 , numericPredictor ? getNumNumeric ( ) : 0 , stringPredictor ? getNumString ( ) : 0 , datePredictor ? getNumDate ( ) : 0 , relationalPredictor ? getNumRelational ( ) : 0 , numClasses , classType , multiInstance ) ; test = makeTestDataset ( 24 , numTest , nominalPredictor ? getNumNominal ( ) : 0 , numericPredictor ? getNumNumeric ( ) : 0 , stringPredictor ? getNumString ( ) : 0 , datePredictor ? getNumDate ( ) : 0 , relationalPredictor ? getNumRelational ( ) : 0 , numClasses , classType , multiInstance ) ; if ( missingLevel > 0 ) { addMissing ( train , missingLevel , predictorMissing , classMissing ) ; addMissing ( test , Math . min ( missingLevel , 50 ) , predictorMissing , classMissing ) ; } classifier = AbstractClassifier . makeCopies ( getClassifier ( ) , 1 ) [ 0 ] ; evaluation = new Evaluation ( train ) ; } catch ( Exception ex ) { throw new Error ( "Error setting up for tests: " + ex . getMessage ( ) ) ; } try { Instances trainCopy = new Instances ( train ) ; Instances testCopy = new Instances ( test ) ; classifier . buildClassifier ( trainCopy ) ; compareDatasets ( train , trainCopy ) ; built = true ; testWRTZeroR ( classifier , evaluation , trainCopy , testCopy ) ; compareDatasets ( test , testCopy ) ; println ( "yes" ) ; result [ 0 ] = true ; } catch ( Exception ex ) { println ( "no" ) ; result [ 0 ] = false ; if ( m_Debug ) { println ( "\n=== Full Report ===" ) ; print ( "Problem during" ) ; if ( built ) { print ( " testing" ) ; } else { print ( " training" ) ; } println ( ": " + ex . getMessage ( ) + "\n" ) ; println ( "Here are the datasets:\n" ) ; println ( "=== Train Dataset ===\n" + train . toString ( ) + "\n" ) ; println ( "=== Test Dataset ===\n" + test . toString ( ) + "\n\n" ) ; } } return result ; }
checks whether the scheme alters the training dataset during training . if the scheme needs to modify the training data it should take a copy of the training data . currently checks for changes to header structure , number of instances , order of instances , instance weights .
