Created
November 19, 2012 11:16
-
-
Save rofr/4110189 to your computer and use it in GitHub Desktop.
Nearest Neighbor test driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
int[] sizes = new int[] { 5000, 10000, 50000, 100000, | |
1000000, 5000000, 10000000 }; | |
for (int numInstances : sizes) { | |
List<LoanApplication> data = getRandomData(numInstances); | |
List<LoanApplication> testData = extractTestData(data, 100); | |
NearestNeighborClassifier<LoanApplication> classifier; | |
System.out.println("Size: " + numInstances); | |
classifier = new NearestNeighborClassifier<LoanApplication>( | |
data, | |
new LoanDistanceFunction(), | |
new LoanApplicationModeAverage(), 4); | |
long millis = measureTestRun(classifier, testData); | |
System.out.println("single threaded:" + millis); | |
classifier = new ParallelNearestNeighborClassifier<LoanApplication>( | |
data, | |
new LoanDistanceFunction(), | |
new LoanApplicationModeAverage(), 4); | |
millis = measureTestRun(classifier, testData); | |
System.out.println("multi threaded:" + millis); | |
System.out.println(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment