MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / IrisTest

Class IrisTest

iris/python/iris_test.py:31–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class IrisTest(unittest.TestCase):
32
33 def setUp(self):
34 self._tmp_dir = tempfile.mkdtemp()
35 super(IrisTest, self).setUp()
36
37 def tearDown(self):
38 if os.path.isdir(self._tmp_dir):
39 shutil.rmtree(self._tmp_dir)
40 super(IrisTest, self).tearDown()
41
42 def testTrainAndSaveNonSequential(self):
43 final_train_accuracy = iris.train(100, self._tmp_dir)
44 self.assertGreater(final_train_accuracy, 0.9)
45
46 # Check that the model json file is created.
47 json.load(open(os.path.join(self._tmp_dir, 'model.json'), 'rt'))
48
49 def testTrainAndSaveSequential(self):
50 final_train_accuracy = iris.train(100, self._tmp_dir, sequential=True)
51 self.assertGreater(final_train_accuracy, 0.9)
52
53 # Check that the model json file is created.
54 json.load(open(os.path.join(self._tmp_dir, 'model.json'), 'rt'))
55
56
57if __name__ == '__main__':

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected