def test_dim(self):
     a = np.array([0, 0, 0, 1])
     with self.assertRaises(ValueError) as context:
         onehot_reverse(a)
     msg = context.exception
     self.assertEqual(str(msg), "Input array must have 2 dimensions\n"
                                "Got predictions.ndim: 1")
 def test_dim(self):
     a = np.array([0, 0, 0, 1])
     with self.assertRaises(ValueError) as context:
         onehot_reverse(a)
     msg = context.exception
     self.assertEqual(
         str(msg), "Input array must have 2 dimensions\n"
         "Got predictions.ndim: 1")
 def test_proba(self):
     a = np.array([[0.66, 0.24, 0.10],
                   [0.66, 0.24, 0.10],
                   [0.66, 0.24, 0.10],
                   [0.24, 0.66, 0.10]])
     got = onehot_reverse(a)
     expect = np.array([0, 0, 0, 1], dtype=np.int32)
     self.assertTrue(np.array_equal(got, expect))
 def test_defaults(self):
     a = np.array([[1., 0., 0., 0.],
                   [0., 1., 0., 0.],
                   [0., 0., 0., 1.],
                   [0., 0., 0., 1.]])
     got = onehot_reverse(a)
     expect = np.array([0, 1, 3, 3], dtype=np.int32)
     self.assertTrue(np.array_equal(got, expect))
 def test_proba(self):
     a = np.array([[0.66, 0.24, 0.10], [0.66, 0.24, 0.10],
                   [0.66, 0.24, 0.10], [0.24, 0.66, 0.10]])
     got = onehot_reverse(a)
     expect = np.array([0, 0, 0, 1], dtype=np.int32)
     self.assertTrue(np.array_equal(got, expect))
 def test_defaults(self):
     a = np.array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 0., 1.],
                   [0., 0., 0., 1.]])
     got = onehot_reverse(a)
     expect = np.array([0, 1, 3, 3], dtype=np.int32)
     self.assertTrue(np.array_equal(got, expect))