Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DCRNN
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yan
DCRNN
Commits
8bae56a4
Commit
8bae56a4
authored
Aug 09, 2019
by
xlwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct an error for metric calculation
parent
b617e1a2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
test.py
test.py
+4
-4
No files found.
test.py
View file @
8bae56a4
...
...
@@ -49,15 +49,15 @@ def main(config):
for
i
,
(
x
,
y
)
in
tqdm
(
enumerate
(
test_data_loader
.
get_iterator
()),
total
=
num_test_iteration
):
x
=
torch
.
FloatTensor
(
x
)
.
cuda
()
y
=
torch
.
FloatTensor
(
y
)
.
cuda
()
outputs
=
model
(
x
,
y
,
0
)
# (seq_length
+1, batch_size, num_nodes*output_dim) (13
, 50, 207*1)
outputs
=
model
(
x
,
y
,
0
)
# (seq_length
, batch_size, num_nodes*output_dim) (12
, 50, 207*1)
y_preds
=
torch
.
cat
([
y_preds
,
outputs
],
dim
=
1
)
y_preds
=
torch
.
transpose
(
y_preds
,
0
,
1
)
y_preds
=
torch
.
transpose
(
y_preds
,
0
,
1
)
# (6850, 12, 207)
y_preds
=
y_preds
.
detach
()
.
numpy
()
# cast to numpy array
print
(
"--------test results--------"
)
for
horizon_i
in
range
(
y_truths
.
shape
[
1
]):
y_truth
=
np
.
squeeze
(
y_truths
[:,
horizon_i
,
:,
0
])
y_truth
=
np
.
squeeze
(
y_truths
[:,
horizon_i
,
:,
0
])
# should be (6850, 207)
y_pred
=
scaler
.
inverse_transform
(
y_preds
[:
y_truth
.
shape
[
0
],
horizon_i
,
:])
y_pred
=
scaler
.
inverse_transform
(
y_preds
[:
y_truth
.
shape
[
0
],
horizon_i
,
:])
# should be (6850, 207)
predictions
.
append
(
y_pred
)
mae
=
metrics
.
masked_mae_np
(
y_pred
,
y_truth
,
null_val
=
0
)
...
...
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