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
7b6af87a
"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "6883294d4450c637b51e9658d1ab503dcc5fa696"
Unverified
Commit
7b6af87a
authored
May 17, 2020
by
Mufei Li
Committed by
GitHub
May 17, 2020
Browse files
Update (#1534)
parent
039fefc2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
examples/pytorch/gat/README.md
examples/pytorch/gat/README.md
+1
-0
examples/pytorch/gat/train_ppi.py
examples/pytorch/gat/train_ppi.py
+3
-3
No files found.
examples/pytorch/gat/README.md
View file @
7b6af87a
...
@@ -46,6 +46,7 @@ Results
...
@@ -46,6 +46,7 @@ Results
| Cora | 84.02(0.40) | 0.0113 | 0.0982 (
**8.7x**
) | 0.0424 (
**3.8x**
) |
| Cora | 84.02(0.40) | 0.0113 | 0.0982 (
**8.7x**
) | 0.0424 (
**3.8x**
) |
| Citeseer | 70.91(0.79) | 0.0111 | n/a | n/a |
| Citeseer | 70.91(0.79) | 0.0111 | n/a | n/a |
| Pubmed | 78.57(0.75) | 0.0115 | n/a | n/a |
| Pubmed | 78.57(0.75) | 0.0115 | n/a | n/a |
| PPI | 0.9836 | n/a | n/a | n/a |
*
All the accuracy numbers are obtained after 300 epochs.
*
All the accuracy numbers are obtained after 300 epochs.
*
The time measures how long it takes to train one epoch.
*
The time measures how long it takes to train one epoch.
...
...
examples/pytorch/gat/train_ppi.py
View file @
7b6af87a
...
@@ -35,7 +35,7 @@ def evaluate(feats, model, subgraph, labels, loss_fcn):
...
@@ -35,7 +35,7 @@ def evaluate(feats, model, subgraph, labels, loss_fcn):
layer
.
g
=
subgraph
layer
.
g
=
subgraph
output
=
model
(
feats
.
float
())
output
=
model
(
feats
.
float
())
loss_data
=
loss_fcn
(
output
,
labels
.
float
())
loss_data
=
loss_fcn
(
output
,
labels
.
float
())
predict
=
np
.
where
(
output
.
data
.
cpu
().
numpy
()
>=
0.
5
,
1
,
0
)
predict
=
np
.
where
(
output
.
data
.
cpu
().
numpy
()
>=
0.
,
1
,
0
)
score
=
f1_score
(
labels
.
data
.
cpu
().
numpy
(),
score
=
f1_score
(
labels
.
data
.
cpu
().
numpy
(),
predict
,
average
=
'micro'
)
predict
,
average
=
'micro'
)
return
score
,
loss_data
.
item
()
return
score
,
loss_data
.
item
()
...
@@ -109,7 +109,7 @@ def main(args):
...
@@ -109,7 +109,7 @@ def main(args):
val_loss_list
.
append
(
val_loss
)
val_loss_list
.
append
(
val_loss
)
mean_score
=
np
.
array
(
score_list
).
mean
()
mean_score
=
np
.
array
(
score_list
).
mean
()
mean_val_loss
=
np
.
array
(
val_loss_list
).
mean
()
mean_val_loss
=
np
.
array
(
val_loss_list
).
mean
()
print
(
"F1-Score: {:.4f} "
.
format
(
mean_score
))
print
(
"
Val
F1-Score: {:.4f} "
.
format
(
mean_score
))
# early stop
# early stop
if
mean_score
>
best_score
or
best_loss
>
mean_val_loss
:
if
mean_score
>
best_score
or
best_loss
>
mean_val_loss
:
if
mean_score
>
best_score
and
best_loss
>
mean_val_loss
:
if
mean_score
>
best_score
and
best_loss
>
mean_val_loss
:
...
@@ -128,7 +128,7 @@ def main(args):
...
@@ -128,7 +128,7 @@ def main(args):
feats
=
feats
.
to
(
device
)
feats
=
feats
.
to
(
device
)
labels
=
labels
.
to
(
device
)
labels
=
labels
.
to
(
device
)
test_score_list
.
append
(
evaluate
(
feats
,
model
,
subgraph
,
labels
.
float
(),
loss_fcn
)[
0
])
test_score_list
.
append
(
evaluate
(
feats
,
model
,
subgraph
,
labels
.
float
(),
loss_fcn
)[
0
])
print
(
"F1-Score: {:.4f}"
.
format
(
np
.
array
(
test_score_list
).
mean
()))
print
(
"
Test
F1-Score: {:.4f}"
.
format
(
np
.
array
(
test_score_list
).
mean
()))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
(
description
=
'GAT'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'GAT'
)
...
...
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