{"id":18348923,"url":"https://github.com/icoxfog417/techcircle_openai_handson","last_synced_at":"2026-02-24T09:05:44.795Z","repository":{"id":145819478,"uuid":"70880891","full_name":"icoxfog417/techcircle_openai_handson","owner":"icoxfog417","description":"Tech-Circle OpenAI Handson Repository","archived":false,"fork":false,"pushed_at":"2017-05-20T07:59:55.000Z","size":1176,"stargazers_count":64,"open_issues_count":0,"forks_count":48,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-28T14:10:18.717Z","etag":null,"topics":["machine-learning","openai-gym","reinforcement-learning"],"latest_commit_sha":null,"homepage":"http://www.slideshare.net/takahirokubo7792/techcircle-18-python-openai-gym","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icoxfog417.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-14T06:32:33.000Z","updated_at":"2023-08-24T01:02:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f666437-22fd-4c0a-a7e1-f0729eca94e3","html_url":"https://github.com/icoxfog417/techcircle_openai_handson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/icoxfog417/techcircle_openai_handson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Ftechcircle_openai_handson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Ftechcircle_openai_handson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Ftechcircle_openai_handson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Ftechcircle_openai_handson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icoxfog417","download_url":"https://codeload.github.com/icoxfog417/techcircle_openai_handson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icoxfog417%2Ftechcircle_openai_handson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29777650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","openai-gym","reinforcement-learning"],"created_at":"2024-11-05T21:19:43.867Z","updated_at":"2026-02-24T09:05:44.756Z","avatar_url":"https://github.com/icoxfog417.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tech Circle OpenAI Gym Handson\n\nTech-Circle #18 「Pythonではじめる強化学習 OpenAI Gym 体験ハンズオン」のハンズオン資料です。\n\n## Setup\n\n事前準備としてOpenAI GymとChainerをインストールします(ChainerはOptionalのハンズオンでのみ必要なため、そこまで行わなければインストールの必要はありません)。  \nWindowsの場合、atariのゲームを動かす環境の構築(手順5以降)はネイティブでは非常に困難です。そのため、以下を参考にbash on Windows環境を構築し、bash環境(=Ubuntu環境)で環境構築を行ってください。\n\n[Bash on Ubuntu on Windowsをインストールしてみよう！](http://qiita.com/Aruneko/items/c79810b0b015bebf30bb)\n\nまた、bash on Windows側から画面を描写するのに[vcXsrv](https://sourceforge.net/projects/vcxsrv/)か[Xming](https://sourceforge.net/projects/xming/)のインストールが必要です。\nインストールするのは新しいvcXsrvのほうが良いですが、動かないケースが報告されているのでその場合はXmingを試してみてください。\nこれらをインストールしServerを起動すると、スクリーンが立ち上がります。bash側で`export DISPLAY=:0`を行い出力先をこのスクリーンに設定することで、実行結果を確認できます(`.bashrc`に書いておくと実行し忘れを防げます)。\n\n1. Pythonのインストール  \nPythonは3を利用します。[こちら](http://qiita.com/icoxfog417/items/e8f97a6acad07903b5b0#python%E3%81%AE%E3%82%BB%E3%83%83%E3%83%88%E3%82%A2%E3%83%83%E3%83%97)などを参考に、Pythonのインストールを行ってください。\nなお、bash on Windowsを利用している場合Linuxベースの環境構築となります(中身はUbuntuのため)。\nWindows側でPythonがインストールされていてもそれはbash環境とは別個なので、仮にWindows側でPythonをインストールしていてもbash側でもインストールを行う必要がある点に注意してください。\n2. リポジトリのfork/clone  \n本リポジトリをforkし、cloneしてください(良ければStarもよろしくですm(_ _)m)。以後、cloneしたフォルダ(`techcircle_openai_handson`)の中で作業をしていきます。\n3. OpenAI Gymのインストール  \n`pip install gym`でOKです。なお、インストールは`virtualenv`や`conda`を使い、仮想環境にインストールすることをお勧めします。仮想環境の作成についての詳細は、上記のリンク先の資料をご参照ください。\n4. Gymの動作確認  \n    本リポジトリの中にある`confirm_hello_gym.py`を実行し動くかどうかを確認してください。  \n\n    ```\n    python confirm_hello_gym.py\n    ```\n\n    上手くインストールできていれば、以下のようにCartPoleが動くはずです。特にWindowsで環境構築を行っている場合は、まずここで実行を確認しておいてください。\n    \n    ![cartpole.PNG](./images/cartpole.PNG)\n5. 依存モジュールのインストール  \nここから、gymでatariのゲームが扱えるよう追加のインストールを行っていきます。[公式ページ](https://github.com/openai/gym#installing-everything)に記載の通り、atari環境を実行するのに必要なライブラリなどをインストールします。\n6. atari環境のインストール  \n`pip install 'gym[atari]'` でインストールを行います\n7. Chainerのインストール  \n`pip install chainer`でインストールします\n8. atariの動作確認  \n     本リポジトリの、`confirm_dqn_env.py`を実行し動くかどうか確認してください。\n\n    ```\n    python confirm_dqn_env.py\n    ```\n\n    ![pong.PNG](./images/pong.PNG)\n\n\nこれで準備は完了です。お疲れさまでした！\n\n### Trouble Shuooting\n\n* Windowsの場合、atari環境の実行のために`python-opengl`の追加インストールが必要かもしれません\n* Windowsの場合、Xmingでないと動かないという報告がありました\n* Python 3.5とChainer(1.17)を組み合わせて使う場合、`export CHAINER_PYTHON_350_FORCE=1`の設定が必要になる可能性があります\n\n## Lecture\n\n[Pythonではじめる強化学習 OpenAI Gym 体験ハンズオン 講義編](http://www.slideshare.net/takahirokubo7792/techcircle-18-python-openai-gym)\n\n## Hands on\n\n### [Start Handson!](https://github.com/icoxfog417/techcircle_openai_handson/tree/master/handson_1)\n\n### Contents\n\n* [Let's Start OpenAI Gym (5min)](https://github.com/icoxfog417/techcircle_openai_handson/tree/master/handson_1)\n * OpenAI Gymを使って、学習環境を動かしてみましょう\n* [Deploy Agent to Environment (5min)](https://github.com/icoxfog417/techcircle_openai_handson/tree/master/handson_2)\n * actionを行うAgentを、学習環境の中に配置してみましょう\n* [Train Agent by Reward (10min)](https://github.com/icoxfog417/techcircle_openai_handson/tree/master/handson_3)\n * agentを、報酬により教育してみましょう。ここで、Q-learningを利用します。\n* [Optional] [Submit Your Agent to OpenAI Gym](https://github.com/icoxfog417/techcircle_openai_handson/tree/master/handson_optional)\n * 学習させたエージェントを、OpenAI Gymに投稿してみましょう\n\n解答編は以下になります\n\n[Handson Answer](https://github.com/icoxfog417/techcircle_openai_handson/tree/answer)\n\n### Trouble Shuooting\n\n* Pythonはインデントで制御構造を判断するため、インデントには気を付けてください\n* インデントをつける際、空白を利用するかタブを利用するかは統一されている必要があります。ハンズオンのコードは空白を利用しているため、タブを混在させてしまわないよう、注意してください\n* コードは、UTF-8(BOM無)で保存する必要があります。Windowsの一部のエディタでは保存時Shift-JISになってしまうので、注意してください\n* コマンドの実行が上手くいかない際は、所定のフォルダにいるかどうかを確認してください。optional以外は、それぞれ該当のフォルダ上(例えば、`handson_1`ならコマンドプロンプト/ターミナルの`cd`コマンドで`handson_1`フォルダに移動してからコマンドを実行する必要があります)\n* `python --version`でPython3系を利用しているか確認してください。`pyenv`などを利用せずPython3をインストールした場合、`python3`コマンドを利用することで明示的にPythonを3系で動かすことができます。\n* コマンドの実行時には、仮想環境を利用している場合activateされているか、またWindowsの場合表示用の画面を立ち上げているかを確認してください\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficoxfog417%2Ftechcircle_openai_handson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficoxfog417%2Ftechcircle_openai_handson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficoxfog417%2Ftechcircle_openai_handson/lists"}