O'Reilly logo

Scala Machine 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

Step 9 - Evaluating the model

Well done! We have finished the training. How about now evaluating the test set:

  val (testLoss, testAcc) = test(testDataCount, batchSize, testData, testLabels, model)         
  println(s"TEST SET DISPLAY STEP:  Batch Loss = ${"%.6f".format(testLoss)}, Accuracy = $testAcc") 
        testAccuracies += testAcc 
        testLosses += testLoss 
      } 
      step += 1 
    }     
  val (finalLoss, accuracy) = test(testDataCount, batchSize, testData, testLabels, model) 
  println(s"FINAL RESULT: Batch Loss= $finalLoss, Accuracy= $accuracy") 
TEST SET DISPLAY STEP: Batch Loss = 0.065859, Accuracy = 0.9138107 TEST SET DISPLAY STEP: Batch Loss = 0.077047, Accuracy = 0.912114 TEST SET DISPLAY STEP: Batch Loss = 0.069186, Accuracy = 0.90566677 TEST SET DISPLAY STEP: Batch Loss ...

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