Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
sjmonagi
Simulated visual based reinforcement learning for navigation with Hindsight experience Replay
Commits
fd0a6b8a
Commit
fd0a6b8a
authored
Apr 03, 2020
by
sjmonagi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
images only
parent
0a76107d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
7 deletions
+38
-7
helper.py
helper.py
+38
-7
No files found.
helper.py
View file @
fd0a6b8a
...
...
@@ -38,6 +38,13 @@ def plotting_training_log(num_episode, plotted_data, successes, failures, loss,
plt
.
ylabel
(
"Successful/Failed Trajectories and Ratio"
)
plt
.
savefig
(
"failed_success_ratio"
+
str
(
num_episode
)
+
".png"
)
# plots of successful failed trajectories and F1 Score between them
plotted_data
.
plot
(
x
=
"Episodes"
,
y
=
[
"Successful trajectories"
,
"Failed trajectories"
,
"F1"
],
title
=
"Agent Learning Ratio"
)
plt
.
xlabel
(
"Episodes"
)
plt
.
ylabel
(
"Successful/Failed Trajectories and F1 Score"
)
plt
.
savefig
(
"failed_success_F1"
+
str
(
num_episode
)
+
".png"
)
# plot of successful trajectories
plotted_data
.
plot
(
x
=
"Episodes"
,
y
=
[
"Successful trajectories"
],
title
=
"Successful Trajectories"
)
...
...
@@ -58,6 +65,12 @@ def plotting_training_log(num_episode, plotted_data, successes, failures, loss,
plt
.
ylabel
(
"Ratio"
)
plt
.
savefig
(
"Ratio"
+
str
(
num_episode
)
+
".png"
)
plotted_data
.
plot
(
x
=
"Episodes"
,
y
=
[
"F1"
],
title
=
"F1 Score between Successful and Failed Trajectory"
)
plt
.
xlabel
(
"Episodes"
)
plt
.
ylabel
(
"F1 Score"
)
plt
.
savefig
(
"F1"
+
str
(
num_episode
)
+
".png"
)
plotted_data
.
plot
(
x
=
"Episodes"
,
y
=
[
"loss"
],
title
=
"HER-DRQN model loss"
)
plt
.
xlabel
(
"Episodes"
)
...
...
@@ -68,7 +81,7 @@ def plotting_training_log(num_episode, plotted_data, successes, failures, loss,
def
validate
(
n
,
nodes_num
,
top_view
,
env
,
envT
,
ae
,
ae_sess
,
distance_threshold
,
model
):
print
(
"### Validation ###"
)
plotted_data_val
=
pd
.
DataFrame
(
columns
=
[
"Episodes"
,
"Successful trajectories"
,
"Failed trajectories"
,
"Ratio"
,
"
loss"
,
"epsilon"
,
"num_steps
"
])
columns
=
[
"Episodes"
,
"Successful trajectories"
,
"Failed trajectories"
,
"Ratio"
,
"
F1
"
])
val_success
=
0
val_failures
=
0
for
i
in
range
(
100
):
...
...
@@ -134,13 +147,31 @@ def validate(n, nodes_num, top_view, env, envT, ae, ae_sess, distance_threshold,
print
(
"validation_success:"
,
val_success
,
"validation_failures:"
,
val_failures
,
"steps_num"
,
num_steps
)
plotted_data_val
=
plotted_data_val
.
append
({
"Episodes"
:
str
(
i
),
"Successes"
:
val_success
/
(
i
+
1
),
"Failures"
:
val_failures
/
(
i
+
1
),
"Ratio"
:
(
val_success
/
(
val_failures
+
0.1
)),
"num_steps"
:
num_steps
},
ignore_index
=
True
)
plotted_data_val
.
plot
(
x
=
"Episodes"
,
y
=
[
"Successes"
,
"Failures"
,
"Ratio"
],
"Successful trajectories"
:
val_success
/
(
i
+
1
),
"Failed trajectories"
:
val_failures
/
(
i
+
1
),
"Ratio"
:
(
val_success
/
(
val_failures
+
1
)),
"F1"
:
((
1
-
(
val_failures
/
(
n
+
1
)))
*
(
val_success
/
(
n
+
1
)))
/
((
1
-
(
val_failures
/
(
n
+
1
)))
+
((
val_success
/
(
n
+
1
)))
+
1
)
},
ignore_index
=
True
)
plotted_data_val
.
plot
(
x
=
"Episodes"
,
y
=
[
"Successful trajectories"
,
"Failed trajectories"
,
"Ratio"
],
title
=
"Validation Agent Learning Ratio"
)
plt
.
xlabel
(
"Episodes"
)
plt
.
ylabel
(
"Successful/Failed Trajectories and Ratio"
)
plt
.
savefig
(
"Vaildation_failed_success_ratio "
+
str
(
n
)
+
str
(
i
)
+
".png"
)
plotted_data_val
.
plot
(
x
=
"Episodes"
,
y
=
[
"Successful trajectories"
,
"Failed trajectories"
,
"F1"
],
title
=
"Validation Agent Learning F1"
)
plt
.
xlabel
(
"Episodes"
)
plt
.
ylabel
(
"Successful/Failed Trajectories and F1 Score"
)
plt
.
savefig
(
"Vaildation_failed_success_F1 "
+
str
(
n
)
+
str
(
i
)
+
".png"
)
plotted_data_val
.
plot
(
x
=
"Episodes"
,
y
=
[
"F1"
],
title
=
"F1 Score"
)
plt
.
xlabel
(
"Episodes"
)
plt
.
ylabel
(
"F1 Score between Successful and Failed Trajectory"
)
plt
.
savefig
(
"F1 Score"
+
str
(
n
)
+
str
(
i
)
+
".png"
)
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