Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
f7360c3c
Unverified
Commit
f7360c3c
authored
Nov 09, 2021
by
Quan (Andy) Gan
Committed by
GitHub
Nov 09, 2021
Browse files
fix link prediction (#3485)
parent
db78fac5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
tutorials/blitz/4_link_predict.py
tutorials/blitz/4_link_predict.py
+1
-1
tutorials/large/L2_large_link_prediction.py
tutorials/large/L2_large_link_prediction.py
+1
-1
No files found.
tutorials/blitz/4_link_predict.py
View file @
f7360c3c
...
...
@@ -99,7 +99,7 @@ neg_u, neg_v = np.where(adj_neg != 0)
neg_eids
=
np
.
random
.
choice
(
len
(
neg_u
),
g
.
number_of_edges
())
test_neg_u
,
test_neg_v
=
neg_u
[
neg_eids
[:
test_size
]],
neg_v
[
neg_eids
[:
test_size
]]
train_neg_u
,
train_neg_v
=
neg_u
[
neg_eids
[
t
rain
_size
:]],
neg_v
[
neg_eids
[
t
rain
_size
:]]
train_neg_u
,
train_neg_v
=
neg_u
[
neg_eids
[
t
est
_size
:]],
neg_v
[
neg_eids
[
t
est
_size
:]]
######################################################################
...
...
tutorials/large/L2_large_link_prediction.py
View file @
f7360c3c
...
...
@@ -395,7 +395,7 @@ test_neg_dst = torch.randint(0, graph.num_nodes(), (graph.num_edges(),))
# You also need to label the edges, 1 if positive and 0 if negative.
#
test_src
=
torch
.
cat
([
test_pos_src
,
test_
neg_src
])
test_src
=
torch
.
cat
([
test_pos_src
,
test_
pos_dst
])
test_dst
=
torch
.
cat
([
test_neg_src
,
test_neg_dst
])
test_graph
=
dgl
.
graph
((
test_src
,
test_dst
),
num_nodes
=
graph
.
num_nodes
())
test_graph
.
edata
[
'label'
]
=
torch
.
cat
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment