Merge pull request #592 from broadinstitute/rp_random_forest_improvements
Balancing training classes between SNP/Indel and TP/FP.
This commit is contained in:
commit
416ccef0c5
|
|
@ -1537,6 +1537,9 @@ public class MathUtils {
|
||||||
* @param N - the number of elements to draw
|
* @param N - the number of elements to draw
|
||||||
*/
|
*/
|
||||||
public static <T> List<T> randomSample(final List<T> list, final int N) {
|
public static <T> List<T> randomSample(final List<T> list, final int N) {
|
||||||
|
if (list.isEmpty() ) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
return sliceListByIndices(sampleIndicesWithReplacement(list.size(),N),list);
|
return sliceListByIndices(sampleIndicesWithReplacement(list.size(),N),list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue