Clean way to stop training#84
Open
AlexisBogroff wants to merge 1 commit intorlcode:masterfrom
AlexisBogroff:patch-1
Open
Clean way to stop training#84AlexisBogroff wants to merge 1 commit intorlcode:masterfrom AlexisBogroff:patch-1
AlexisBogroff wants to merge 1 commit intorlcode:masterfrom
AlexisBogroff:patch-1
Conversation
- Avoid using sys.exit() - Use a boolean instead
keon
reviewed
Nov 6, 2018
| # stop training | ||
| if np.mean(scores[-min(10, len(scores)):]) > 490: | ||
| sys.exit() | ||
| complete = True |
Member
There was a problem hiding this comment.
why don't we just break here? and not use complete flag?
Author
|
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 <notifications@github.com> Date : 06/11/2018 20:39 (GMT+01:00) À : rlcode/reinforcement-learning <reinforcement-learning@noreply.github.com> Cc : AlexisBogroff <alexis.bogroff@gmail.com>, Author <author@noreply.github.com> 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"
}
]
|
This file contains hidden or 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
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.