Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygo-agent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biluo Shen
ygo-agent
Commits
15833b80
Commit
15833b80
authored
Feb 19, 2024
by
biluo.shen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add discard_hand
parent
2957a343
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
scripts/dmc.py
scripts/dmc.py
+7
-3
No files found.
scripts/dmc.py
View file @
15833b80
...
...
@@ -51,7 +51,7 @@ class Args:
n_history_actions
:
int
=
8
"""the number of history actions to use"""
play_mode
:
str
=
"self"
"""the play mode, can be combination of 'self', 'bot', '
greedy
', like 'self+bot'"""
"""the play mode, can be combination of 'self', 'bot', '
random
', like 'self+bot'"""
num_layers
:
int
=
2
"""the number of layers for the agent"""
...
...
@@ -163,6 +163,7 @@ if __name__ == "__main__":
optimizer
=
optim
.
Adam
(
agent
.
parameters
(),
lr
=
args
.
learning_rate
,
eps
=
1e-5
)
avg_win_rates
=
[]
avg_ep_returns
=
[]
elo
=
Elo
()
selfplay
=
"self"
in
args
.
play_mode
...
...
@@ -233,11 +234,12 @@ if __name__ == "__main__":
avg_win_rates
.
append
(
1
-
winner
)
else
:
# win rate of agent
winner
=
0
if
episode_reward
==
1
else
1
winner
=
0
if
episode_reward
>
0
else
1
elo
.
update
(
winner
)
writer
.
add_scalar
(
"charts/elo_rating"
,
elo
.
r0
,
global_step
)
else
:
winner
=
0
if
episode_reward
==
1
else
1
avg_ep_returns
.
append
(
episode_reward
)
winner
=
0
if
episode_reward
>
0
else
1
avg_win_rates
.
append
(
1
-
winner
)
elo
.
update
(
winner
)
writer
.
add_scalar
(
"charts/elo_rating"
,
elo
.
r0
,
global_step
)
...
...
@@ -245,7 +247,9 @@ if __name__ == "__main__":
if
len
(
avg_win_rates
)
>
100
:
writer
.
add_scalar
(
"charts/avg_win_rate"
,
np
.
mean
(
avg_win_rates
),
global_step
)
writer
.
add_scalar
(
"charts/avg_ep_return"
,
np
.
mean
(
avg_ep_returns
),
global_step
)
avg_win_rates
=
[]
avg_ep_returns
=
[]
to_play
=
infos
[
'to_play'
]
if
selfplay
else
None
obs
=
next_obs
...
...
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