MCPcopy Create free account
hub / github.com/apache/singa / to_categorical

Method to_categorical

test/python/test_model.py:337–342  ·  view source on GitHub ↗
(self, y, num_classes)

Source from the content-addressed store, hash-verified

335class TestPythonModule(unittest.TestCase):
336
337 def to_categorical(self, y, num_classes):
338 y = np.array(y, dtype="int")
339 n = y.shape[0]
340 categorical = np.zeros((n, num_classes))
341 categorical[np.arange(n), y] = 1
342 return categorical
343
344 def generate_data(self, dev, num=400):
345 f = lambda x: (5 * x + 1)

Callers 1

generate_dataMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected