public static < U , I > void run ( final Properties properties , final TemporalDataModelIF < U , I > data , final boolean doDataClear ) throws FileNotFoundException , UnsupportedEncodingException { System . out . println ( "Start splitting" ) ; TemporalDataModelIF < U , I > [ ] splits ; // read parameters String outputFolder = properties . getProperty ( SPLIT_OUTPUT_FOLDER ) ; Boolean overwrite = Boolean . parseBoolean ( properties . getProperty ( SPLIT_OUTPUT_OVERWRITE , "false" ) ) ; String fieldDelimiter = properties . getProperty ( SPLIT_FIELD_DELIMITER , "\t" ) ; String splitTrainingPrefix = properties . getProperty ( SPLIT_TRAINING_PREFIX ) ; String splitTrainingSuffix = properties . getProperty ( SPLIT_TRAINING_SUFFIX ) ; String splitTestPrefix = properties . getProperty ( SPLIT_TEST_PREFIX ) ; String splitTestSuffix = properties . getProperty ( SPLIT_TEST_SUFFIX ) ; // generate splits Splitter < U , I > splitter = instantiateSplitter ( properties ) ; splits = splitter . split ( data ) ; if ( doDataClear ) { data . clear ( ) ; } System . out . println ( "Saving splits" ) ; // save splits for ( int i = 0 ; i < splits . length / 2 ; i ++ ) { TemporalDataModelIF < U , I > training = splits [ 2 * i ] ; TemporalDataModelIF < U , I > test = splits [ 2 * i + 1 ] ; String trainingFile = outputFolder + splitTrainingPrefix + i + splitTrainingSuffix ; String testFile = outputFolder + splitTestPrefix + i + splitTestSuffix ; DataModelUtils . saveDataModel ( training , trainingFile , overwrite , fieldDelimiter ) ; DataModelUtils . saveDataModel ( test , testFile , overwrite , fieldDelimiter ) ; } }
Runs a Splitter instance based on the properties .