CCIIPLab / GCE-GNN

The source code for "Global Context Enhanced Graph Neural Network for Session-based Recommendation".
124 stars 30 forks source link

Question w.r.t data processing #2

Closed familyld closed 3 years ago

familyld commented 3 years ago

According to your code in utils.py:

    for i in np.arange(len(u_input) - 1):
            u = np.where(node == u_input[i])[0][0]
            u_adj[u][u] = 1
            if u_input[i + 1] == 0:
                break
            v = np.where(node == u_input[i + 1])[0][0]
            if u_adj[u][v] == 2:
                u_adj[v][u] = 4
            else:
                u_adj[v][u] = 3
            if u_adj[v][u] == 3:
                u_adj[u][v] = 4
            else:
                u_adj[u][v] = 2
            u_adj[v][v] = 1

It seems that u_adj[u][v] will never be set as 2. I test the code on Diginetica and u_adj[u][v] = 2 never happens. Is this a bug or can you show us an example for it? What does 2 stand for?

Thank you.

Mikrokosmos1997 commented 3 years ago

We have fixed this bug in the latest version,

for i in np.arange(len(u_input) - 1):
    u = np.where(node == u_input[i])[0][0]
    adj[u][u] = 1
    if u_input[i + 1] == 0:
        break
    v = np.where(node == u_input[i + 1])[0][0]
    if u == v or adj[u][v] == 4:
        continue
    adj[v][v] = 1
    if adj[v][u] == 2:
        adj[u][v] = 4
        adj[v][u] = 4
    else:
        adj[u][v] = 2
        adj[v][u] = 3

1, 2, 3, and 4 denote different types of edges between node u and node v.