'ValueError: row index exceeds matrix dimensions sparse coo max
I really have no idea what's the root cause! I have created below matrix and had tried increase the (M, N) size, or reduce the data size or the row size or column size or even change the dtype from float32 to float64, but all fails! I keep getting 'row index exceeds matrix dimensions' errow, please help if you have any clues, thank you.
adj = sp.coo_matrix((np.ones(edges.shape[0]), (edges[:, 0],edges[:, 1])),
shape=(np.max(node_labels.shape[0])+1, np.max(node_labels.shape[0])+1), dtype=np.float32)
Besides,
len(np.ones(edges.shape[0])) = len(edges[:, 0]) = len(edges[:, 1])= 1432000
and
len(node_labels.shape[0]) = 1432002
np.max(node_labels.shape[0])+1 = 1432003
You may have already found that, my "edges" size is much lower than my "node_labels" size, how come i still get row index exceed error???
Solution 1:[1]
I had solved the problem myself, well, the truth is quite cruel, just need to re encode the values in edges[:, 0]) and edges[:, 1], however, i have no idea how it will affect my gcn model as i only encode columns of edge.csv leaving nodes.csv unchanged...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Alicia |