public static < U , I > Splitter < U , I > instantiateSplitter ( final Properties properties ) { // read parameters String splitterClassName = properties . getProperty ( DATASET_SPLITTER ) ; Boolean perUser = Boolean . parseBoolean ( properties . getProperty ( SPLIT_PERUSER ) ) ; Boolean doSplitPerItems = Boolean . parseBoolean ( properties . getProperty ( SPLIT_PERITEMS , "true" ) ) ; // generate splitter Splitter < U , I > splitter = null ; if ( splitterClassName . contains ( "CrossValidation" ) ) { Long seed = Long . parseLong ( properties . getProperty ( SPLIT_SEED ) ) ; Integer nFolds = Integer . parseInt ( properties . getProperty ( SPLIT_CV_NFOLDS ) ) ; splitter = new CrossValidationSplitter <> ( nFolds , perUser , seed ) ; } else if ( splitterClassName . contains ( "Random" ) ) { Long seed = Long . parseLong ( properties . getProperty ( SPLIT_SEED ) ) ; Float percentage = Float . parseFloat ( properties . getProperty ( SPLIT_RANDOM_PERCENTAGE ) ) ; splitter = new RandomSplitter <> ( percentage , perUser , seed , doSplitPerItems ) ; } else if ( splitterClassName . contains ( "Temporal" ) ) { Float percentage = Float . parseFloat ( properties . getProperty ( SPLIT_RANDOM_PERCENTAGE ) ) ; splitter = new TemporalSplitter <> ( percentage , perUser , doSplitPerItems ) ; } else if ( splitterClassName . contains ( "Validation" ) ) { Long seed = Long . parseLong ( properties . getProperty ( SPLIT_SEED ) ) ; Float percentage = Float . parseFloat ( properties . getProperty ( SPLIT_RANDOM_PERCENTAGE ) ) ; Splitter < U , I > randomSplitter = new RandomSplitter <> ( percentage , perUser , seed , doSplitPerItems ) ; splitter = new ValidationSplitter <> ( randomSplitter ) ; } return splitter ; }
Instantiates a splitter based on the properties .