Sorry I wasn’t able to find it since it’s been almost a year. Let me briefly explain how this works:
-
Assume we have
X
for node or graph features, which is a tensor of shape(N, M)
, whereN
can be either number of nodes or graphs andM
is feature size. -
We can convert
X
to an NumPy array and then pass it to t-sne implemented in scikit-learn, as in the example below:X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]]) X_embedded = TSNE(n_components=2).fit_transform(X)
As a result,
X_embedded
will now be a numpy array of shape(N, 2)
, which can be considered asX
embedded in a 2-dimensional space while preserving some similarity characteristics. -
Finally the two features for each data point can be used in a scatter plot with matplotlib. The color reflects the type of corresponding graph.