|
import java.text.NumberFormat;
public class Stopwatch {
public static void time(String title, Benchmarkable run)
{
GenerateData data = new GenerateData();
data.generate(10000, Benchmark.INPUT_COUNT, Benchmark.OUTPUT_COUNT, -1, 1);
double[][] input = data.getInput();
double[][] ideal = data.getIdeal();
run.prepareBenchmark(input, ideal);
long started = System.currentTimeMillis();
run.benchmark(50);
long finish = System.currentTimeMillis();
long elapsed = finish-started;
double e2 = elapsed/1000.0;
NumberFormat f = NumberFormat.getNumberInstance();
f.setMinimumFractionDigits(4);
f.setMaximumFractionDigits(4);
System.out.println(f.format(e2) + " seconds for " + title );
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Hello, I am a student at Rutgers University. I am in computer science and am learning about machine learning and AI.