[Blog] Batched Graph Classification with DGL

Sorry I wasn’t able to find it since it’s been almost a year. Let me briefly explain how this works:

  1. Assume we have X for node or graph features, which is a tensor of shape (N, M), where N can be either number of nodes or graphs and M is feature size.

  2. 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 as X embedded in a 2-dimensional space while preserving some similarity characteristics.

  3. 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.

1 Like

thank you indeed you’re response was very helpful and you are very kind

1 Like