(id, type, weight, label, feature)
| 61 | |
| 62 | def convert2json(self, convert_dir, out_dir): |
| 63 | def add_node(id, type, weight, label, feature): |
| 64 | node_buf = {} |
| 65 | node_buf["id"] = id |
| 66 | node_buf["type"] = type |
| 67 | node_buf["weight"] = weight |
| 68 | node_buf["features"] = [{}, {}] |
| 69 | node_buf['features'][0]['name'] = 'label' |
| 70 | node_buf['features'][0]['type'] = 'dense' |
| 71 | node_buf['features'][0]['value'] = label.astype( |
| 72 | float).tolist() |
| 73 | node_buf['features'][1]['name'] = 'feature' |
| 74 | node_buf['features'][1]['type'] = 'dense' |
| 75 | feature = feature.astype(float) |
| 76 | feature /= np.sum(feature) + 1e-7 |
| 77 | node_buf['features'][1]['value'] = feature.tolist() |
| 78 | return node_buf |
| 79 | |
| 80 | def add_edge(src, dst, type, weight): |
| 81 | edge_buf = {} |
nothing calls this directly
no outgoing calls
no test coverage detected