Package com.bayesserver.data
Class CrossValidation
- java.lang.Object
-
- com.bayesserver.data.CrossValidation
-
public final class CrossValidation extends Object
Allows test metrics/scores to be calculated using cross validation.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
combine(Iterable<CrossValidationTestResult> testResults, CrossValidationCombineMethod method)
Provides standard ways of combining numeric test results from a number of partitions.static CrossValidationScore[]
kFold(int partitionCount, int testMetricCount, CrossValidationActions actions)
Performs k-fold cross validation.static List<CrossValidationOutput>
kFoldList(int partitionCount)
Gets a list of training and test DataPartitioning instances for each partition.
-
-
-
Method Detail
-
kFoldList
public static List<CrossValidationOutput> kFoldList(int partitionCount)
Gets a list of training and test DataPartitioning instances for each partition. This method is an alternative to the callback basedkFold(int, int, com.bayesserver.data.CrossValidationActions)
method.- Parameters:
partitionCount
- The number of k-fold partitions.- Returns:
- Training and test DataPartitioning instances for each partition.
-
kFold
public static CrossValidationScore[] kFold(int partitionCount, int testMetricCount, CrossValidationActions actions)
Performs k-fold cross validation.- Parameters:
partitionCount
- The number of partitions to use.testMetricCount
- The number of test metrics being calculated.actions
- User supplied actions for the cross validation process.- Returns:
- A score for each test metric.
-
combine
public static double combine(Iterable<CrossValidationTestResult> testResults, CrossValidationCombineMethod method)
Provides standard ways of combining numeric test results from a number of partitions. These can be used in the combine each phase of k-fold cross validation.- Parameters:
testResults
- The test results. Typically one for each test partitioning.method
- The method to be used to combine the test results.- Returns:
- The overall cross validation score, which can be used to compare models.
-
-