Have been trying the python notebook tutorials on https://github.com/dglai/WWW20-Hands-on-Tutorial.

  1. fraud.ipynb is not opening
  2. Training Loop cannot be run in recsys.ipynb while trying running the code in colab.
    Error that appears while running:
    DGLError: Edge type name must be specified if there are more than one edge types.
    Please help to clarify on these issues
  1. We do not have a fraud detection tutorial in WWW. You can safely ignore it since it’s empty.
  2. The error is because 0.5 changed the interface of dgl.remove_edges. The fix is to change the statement with dgl.remove_edges to this:
            sampled_with_edges_removed = dgl.remove_edges(
                sampled_graph, edges_to_remove, 'watched')
            sampled_with_edges_removed = dgl.remove_edges(
                sampled_with_edges_removed, edges_to_remove, 'watched-by')

Will fix it later.

I trying to reproduce the same example and after @BarclayII fixes, it’s returning the following errors:

IndexError                                Traceback (most recent call last)
<ipython-input-14-862ce3753e90> in <module>()
     29             predictions = []
     30             ratings = []
---> 31             for pair_graph, blocks in t:
     32                 user_emb, item_emb = model(blocks)
     33                 prediction = model.compute_score(pair_graph, user_emb, item_emb)

5 frames
<ipython-input-9-500f9e8310e7> in construct_blocks(self, seeds, user_item_pairs_to_remove)
     56             sampled_with_edges_removed = dgl.remove_edges(
     57                 sampled_with_edges_removed, edges_to_remove, 'watched-by')
---> 58             sampled_eids = sampled_eids[sampled_with_edges_removed.edges['watched'].data[dgl.EID]]
     59             sampled_eids_rev = sampled_eids_rev[sampled_with_edges_removed.edges['watched-by'].data[dgl.EID]]

IndexError: index 47282 is out of bounds for dimension 0 with size 44138

Also, it’s not 100% clear to me if to use the LinkPredictionMinibatchSampler I need to replace the class MinibatchSampler in the variable sampler and implement a new loss function to replace the rmse. Is it right?

It turns out that remove_edges returns the graph itself if the given edge ID array is empty. Therefore we need to change the statement to this instead:

sampled_with_edges_removed = sampled_graph
if len(edges_to_remove) > 0:
    sampled_with_edges_removed = dgl.remove_edges(
        sampled_with_edges_removed, edges_to_remove, 'watched')
    sampled_eids = sampled_eids[sampled_with_edges_removed.edges['watched'].data[dgl.EID]]
if len(edges_to_remove_rev) > 0:
    sampled_with_edges_removed = dgl.remove_edges(
        sampled_with_edges_removed, edges_to_remove_rev, 'watched-by')
    sampled_eids_rev = sampled_eids_rev[sampled_with_edges_removed.edges['watched-by'].data[dgl.EID]]
1 Like