O'Reilly logo

Java Deep Learning Projects by Md. Rezaul Karim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performance evaluation

To evaluate the network performance, I wrote the evaluateClassificationPerformance() method, which takes the test set and evalTimeSeries evaluation, as shown here:

private static void evaluateClassificationPerformance(MultiLayerNetwork net, int testStartIdx,                      int nExamples, DataSetIterator testData) throws Exception {          Evaluation evaluation = new Evaluation(NUM_CLASSES);          while(testData.hasNext()) {                DataSet dsTest = testData.next();                INDArray predicted = net.output(dsTest.getFeatureMatrix(), false);                INDArray actual = dsTest.getLabels();                 evaluation.evalTimeSeries(actual, predicted);                 }          System.out.println(evaluation.stats());}
>>> Predictions labeled as 0 classified by model as 0: 493 times Predictions labeled as 0 classified ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required