Initial commit of the random forest classifier.

This commit is contained in:
Ryan Poplin 2013-12-01 15:51:34 -05:00
parent cb2d937a34
commit 43c20264b0
2 changed files with 11 additions and 1 deletions

View File

@ -124,7 +124,8 @@ public class Tranche {
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
final PrintStream stream = new PrintStream(bytes);
Collections.sort( tranches, new TrancheTruthSensitivityComparator() );
if( tranches.size() > 1 )
Collections.sort( tranches, new TrancheTruthSensitivityComparator() );
stream.println("# Variant quality score tranches file");
stream.println("# Version number " + CURRENT_VERSION);

View File

@ -1531,6 +1531,15 @@ public class MathUtils {
return sliceListByIndices(sampleIndicesWithoutReplacement(list.size(),N),list);
}
/**
* Draw N random elements from list with replacement
* @param list - the list from which to draw randomly
* @param N - the number of elements to draw
*/
public static <T> List<T> randomSample(final List<T> list, final int N) {
return sliceListByIndices(sampleIndicesWithReplacement(list.size(),N),list);
}
/**
* Return the likelihood of observing the counts of categories having sampled a population
* whose categorial frequencies are distributed according to a Dirichlet distribution