### Question:
TrainMnist { private TrainMnist() {} private  TrainMnist(); static void main(String[] args); static TrainingResult runExample(String[] args);  }### Answer:
@Test public void testTrainMnist() throws ModelException, TranslateException, IOException { if (Boolean.getBoolean("nightly")) { String[] args = new String[] {"-g", "1"}; TrainingResult result = TrainMnist.runExample(args); Assert.assertNotNull(result); float accuracy = result.getValidateEvaluation("Accuracy"); float loss = result.getValidateLoss(); Assert.assertTrue(accuracy > 0.9f, "Accuracy: " + accuracy); Assert.assertTrue(loss < 0.35f, "Loss: " + loss); Classifications classifications = ImageClassification.predict(); Classifications.Classification best = classifications.best(); Assert.assertEquals(best.getClassName(), "0"); Assert.assertTrue(Double.compare(best.getProbability(), 0.9) > 0); } else { String[] args = new String[] {"-g", "1", "-m", "2"}; TrainMnist.runExample(args); } }