public static TransposeDataCollection randomSampling ( TransposeDataList strataIdList , AssociativeArray nh , boolean withReplacement ) { TransposeDataCollection sampledIds = new TransposeDataCollection ( ) ; for ( Map . Entry < Object , FlatDataList > entry : strataIdList . entrySet ( ) ) { Object strata = entry . getKey ( ) ; Number sampleN = ( ( Number ) nh . get ( strata ) ) ; if ( sampleN == null ) { continue ; } sampledIds . put ( strata , SimpleRandomSampling . randomSampling ( entry . getValue ( ) , sampleN . intValue ( ) , withReplacement ) ) ; } return sampledIds ; }
Samples nh ids from each strata by using Stratified Sampling