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
61b2f4e2
Unverified
Commit
61b2f4e2
authored
Aug 02, 2023
by
Andrei Ivanov
Committed by
GitHub
Aug 03, 2023
Browse files
Improving the APPNP example. (#6054)
parent
31f1b30c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
examples/pytorch/appnp/train.py
examples/pytorch/appnp/train.py
+13
-14
No files found.
examples/pytorch/appnp/train.py
View file @
61b2f4e2
...
...
@@ -51,7 +51,7 @@ def main(args):
val_mask
=
g
.
ndata
[
"val_mask"
]
test_mask
=
g
.
ndata
[
"test_mask"
]
in_feats
=
features
.
shape
[
1
]
n_classes
=
data
.
num_la
bel
s
n_classes
=
data
.
num_
c
la
sse
s
n_edges
=
g
.
num_edges
()
print
(
"""----Data statistics------'
...
...
@@ -97,7 +97,7 @@ def main(args):
)
# initialize graph
dur
=
[]
mean
=
0
for
epoch
in
range
(
args
.
n_epochs
):
model
.
train
()
if
epoch
>=
3
:
...
...
@@ -111,19 +111,18 @@ def main(args):
optimizer
.
step
()
if
epoch
>=
3
:
dur
.
append
(
time
.
time
()
-
t0
)
acc
=
evaluate
(
model
,
features
,
labels
,
val_mask
)
print
(
"Epoch {:05d} | Time(s
) {:.
4
f}
| Loss {:.4f} | Accuracy {:.4f} | "
"ETputs(KTEPS) {:.2f}"
.
format
(
epoch
,
np
.
mean
(
dur
),
loss
.
item
()
,
acc
,
n_edges
/
np
.
mean
(
dur
)
/
1000
,
mean
=
(
mean
*
(
epoch
-
3
)
+
(
time
.
time
()
-
t0
)
)
/
(
epoch
-
2
)
acc
=
evaluate
(
model
,
features
,
labels
,
val_mask
)
print
(
"Epoch {:05d} | Time(s) {:.4f} | Loss {:.4f} | Accuracy {:.4f} | "
"ETputs(KTEPS
) {:.
2
f}
"
.
format
(
epoch
,
mean
,
loss
.
item
(
),
acc
,
n_edges
/
mean
/
1000
,
)
)
)
print
()
acc
=
evaluate
(
model
,
features
,
labels
,
test_mask
)
...
...
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