MCPcopy
hub / github.com/tkipf/pygcn / encode_onehot

Function encode_onehot

pygcn/utils.py:6–12  ·  view source on GitHub ↗
(labels)

Source from the content-addressed store, hash-verified

4
5
6def encode_onehot(labels):
7 classes = set(labels)
8 classes_dict = {c: np.identity(len(classes))[i, :] for i, c in
9 enumerate(classes)}
10 labels_onehot = np.array(list(map(classes_dict.get, labels)),
11 dtype=np.int32)
12 return labels_onehot
13
14
15def load_data(path="../data/cora/", dataset="cora"):

Callers 1

load_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected