def test_ClassificationStrings_CreateTargets(self): y = ['cat', 'cat', 'dog', 'mouse'] cdict = c_dictT(y) y1 = np.vstack(batchT(y, c_dict=cdict)[0]) self.assertTrue(y1.shape[0] == 4) self.assertTrue(y1.shape[1] == 3) self.assertTrue(np.all(y1.sum(1) == 1))
def test_ClassificationY_CreateTargets(self): y = np.array([1, 1, 2, 3]) cdict = c_dictT(y) y1 = np.vstack(batchT(y, c_dict=cdict)[0]) self.assertTrue(y1.shape[0] == 4) self.assertTrue(y1.shape[1] == 3) self.assertTrue(np.all(y1.sum(1) == 1))
def test_OneDimensionalY_ReshapeY(self): y1 = np.array([4, 5, 6]) y2 = np.array([[4], [5], [6]]) y1p = np.vstack(batchT(y1)[0]) self.assertEqual(y2.shape, y1p.shape) self.assertTrue(np.allclose(y2, y1p))
def test_batchT_NumberOfClassificationTargets(self): y = ['cat', 'cat', 'dog', 'mouse'] cdict = c_dictT(y) _, ctargets = batchT(y, c_dict=cdict) self.assertEqual(3, ctargets)
def test_batchT_GetNumberOfTargets(self): y = [[1, 2], [3, 4], [5, 6]] _, targets = batchT(y) self.assertEqual(2, targets)