private static Tuple <ErrorRatePair, List <ErrorRatePair> > CalculateErrorRate <T>(SampleSet <T> sampleSet, ClassifierFactory <T> classifier, int trainingSize, double threshold, int xValidationStart, int xValidationLength) where T : ISample { // test classifier instances with testing samples and threshold asynchronously to get cross validated result List <ErrorRatePair> errorRates = Enumerable.Range(xValidationStart, xValidationLength).AsParallel() .Select(x => CalculateErrorRate(classifier.GetInstance(x), SampleSetHelpers.GetSampleSetTestingSamples(sampleSet, trainingSize, x), threshold)) .ToList(); ErrorRatePair totalError = errorRates[0]; for (int i = 1; i < errorRates.Count; i++) { totalError = totalError + errorRates[i]; } return(new Tuple <ErrorRatePair, List <ErrorRatePair> >(totalError, errorRates)); }
public static BiometricResult Evaluate(ClassifierFactory <ISample> classifier, List <ISample> testingSamples) { return(Evaluate(classifier.GetInstance(0), testingSamples)); }