rlcode / reinforcement-learning

Minimal and Clean Reinforcement Learning Examples
MIT License
3.35k stars 725 forks source link

Clean way to stop training #84

Open AlexisBogroff opened 5 years ago

AlexisBogroff commented 5 years ago

Indeed, sys.exit() unexpectedly kills python, rather than properly stopping the script.

AlexisBogroff commented 5 years ago

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":"https://github.com/rlcode/reinforcement-learning/pull/84#pullrequestreview-172197382"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/rlcode/reinforcement-learning/pull/84#pullrequestreview-172197382", "url": "https://github.com/rlcode/reinforcement-learning/pull/84#pullrequestreview-172197382", "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": "https://github.com/rlcode/reinforcement-learning/pull/84#pullrequestreview-172197382" } ], "@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" } ]