-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean way to stop training #84
Open
AlexisBogroff
wants to merge
1
commit into
rlcode:master
Choose a base branch
from
AlexisBogroff:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Avoid using sys.exit() - Use a boolean instead
keon
reviewed
Nov 6, 2018
@@ -162,7 +164,7 @@ def train_model(self): | |||
# if the mean of scores of last 10 episode is bigger than 490 | |||
# stop training | |||
if np.mean(scores[-min(10, len(scores)):]) > 490: | |||
sys.exit() | |||
complete = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we just break here? and not use complete
flag?
I forgot removing sys.exit(). The sys library may cause trouble when interrupting some configurations
Envoyé depuis mon smartphone Samsung Galaxy.
-------- Message d'origine --------De : Keon <[email protected]> Date : 06/11/2018 20:39 (GMT+01:00) À : rlcode/reinforcement-learning <[email protected]> Cc : AlexisBogroff <[email protected]>, Author <[email protected]> Objet : Re: [rlcode/reinforcement-learning] Clean way to stop training (#84)
@keon commented on this pull request.
In 2-cartpole/1-dqn/cartpole_dqn.py:
@@ -162,7 +164,7 @@ def train_model(self):
# if the mean of scores of last 10 episode is bigger than 490
# stop training
if np.mean(scores[-min(10, len(scores)):]) > 490:
- sys.exit()
+ complete = True
why don't we just break here? and not use complete flag?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/rlcode/reinforcement-learning","title":"rlcode/reinforcement-learning","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/rlcode/reinforcement-learning"}},"updates":{"snippets":[{"icon":"PERSON","message":"@keon commented on #84"}],"action":{"name":"View Pull Request","url":"#84 (review)"}}}
[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "#84 (review)",
"url": "#84 (review)",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "@keon commented on 84",
"sections": [
{
"text": "",
"activityTitle": "**Keon**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@keon",
"facts": [
]
}
],
"potentialAction": [
{
"targets": [
{
"os": "default",
"uri": "#84 (review)"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 406781850\n}"
}
],
"themeColor": "26292E"
}
]
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Indeed, sys.exit() unexpectedly kills python, rather than properly stopping the script.