question: protected void compareDatasets ( Instances data1 , Instances data2 ) throws Exception { if ( ! data2 . equalHeaders ( data1 ) ) { throw new Exception ( "header has been modified\n" + data2 . equalHeadersMsg ( data1 ) ) ; } if ( ! ( data2 . numInstances ( ) == data1 . numInstances ( ) ) ) { throw new Exception ( "number of instances has changed" ) ; } for ( int i = 0 ; i < data2 . numInstances ( ) ; i ++ ) { Instance orig = data1 . instance ( i ) ; Instance copy = data2 . instance ( i ) ; for ( int j = 0 ; j < orig . numAttributes ( ) ; j ++ ) { if ( orig . isMissing ( j ) ) { if ( ! copy . isMissing ( j ) ) { throw new Exception ( "instances have changed" ) ; } } else if ( orig . value ( j ) != copy . value ( j ) ) { throw new Exception ( "instances have changed" ) ; } if ( orig . weight ( ) != copy . weight ( ) ) { throw new Exception ( "instance weights have changed" ) ; } } } }
target:  Compare two datasets to see if they differ.