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
Xfor node or graph features, which is a tensor of shape
(N, M), where
Ncan be either number of nodes or graphs and
Mis feature size.
We can convert
Xto 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_embeddedwill now be a numpy array of shape
(N, 2), which can be considered as
Xembedded 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.