Skip to content

Using training triplet index as edge ID? #9

@treble-maker123

Description

@treble-maker123

In the train.py script, copied and pasted below, the first element of the tuple for the adj_list is the index of the train_triplets,

adj_list = [[] for _ in entities]
for i,triplet in enumerate(train_triplets):
    adj_list[triplet[0]].append([i, triplet[2]])
    adj_list[triplet[2]].append([i, triplet[0]])

Later on in the sample_edge_neighborhood method, you have the follow code to sample the edge,

chosen_vertex = np.random.choice(np.arange(degrees.shape[0]), p=probabilities)
chosen_adj_list = adj_list[chosen_vertex]
seen[chosen_vertex] = True

...

chosen_edge = np.random.choice(np.arange(chosen_adj_list.shape[0]))
chosen_edge = chosen_adj_list[chosen_edge]
edge_number = chosen_edge[0]

The chosen_adj_list is an array of shape num_neighbors x 2, the second dimension being the tuple you're appending in the previous code block. But here, chosen_edge[0] would give you the index of the training triplet, which is not in anyway related to the edge type of the triplet, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions