{"id":15753729,"url":"https://github.com/marella/train","last_synced_at":"2026-05-03T16:31:59.750Z","repository":{"id":57476880,"uuid":"228056597","full_name":"marella/train","owner":"marella","description":"A library to build and train reinforcement learning agents in OpenAI Gym environments.","archived":false,"fork":false,"pushed_at":"2020-01-27T12:07:20.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-06T22:29:17.293Z","etag":null,"topics":["gym","machine-learning","python","reinforcement-learning","tensorflow"],"latest_commit_sha":null,"homepage":"https://train.readthedocs.io","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/marella.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2019-12-14T16:53:01.000Z","updated_at":"2024-02-14T02:08:41.000Z","dependencies_parsed_at":"2022-09-14T12:30:46.317Z","dependency_job_id":null,"html_url":"https://github.com/marella/train","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marella/train","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Ftrain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Ftrain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Ftrain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Ftrain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marella","download_url":"https://codeload.github.com/marella/train/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marella%2Ftrain/sbom","scorecard":{"id":618810,"data":{"date":"2025-08-11","repo":{"name":"github.com/marella/train","commit":"3c4ba1f59bf20e31f7ee5ea9a8f38e49440a93f7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T04:42:52.212Z","repository_id":57476880,"created_at":"2025-08-21T04:42:52.212Z","updated_at":"2025-08-21T04:42:52.212Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32577120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"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":["gym","machine-learning","python","reinforcement-learning","tensorflow"],"created_at":"2024-10-04T07:41:51.729Z","updated_at":"2026-05-03T16:31:59.735Z","avatar_url":"https://github.com/marella.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Train\n=====\n\nA library to build and train reinforcement learning agents in OpenAI Gym environments.\n\n.. image:: https://travis-ci.org/marella/train.svg?branch=master\n    :target: https://travis-ci.org/marella/train\n    :alt: Build Status\n.. image:: https://readthedocs.org/projects/train/badge/?version=latest\n    :target: https://train.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\nRead full documentation `here \u003chttps://train.readthedocs.io/\u003e`_.\n\nGetting Started\n***************\n\nAn agent has to implement the ``act()`` method which takes the current ``state`` as input and returns an action:\n\n.. code:: python\n\n    from train import Agent\n\n    class RandomAgent(Agent):\n\n        def act(self, state):\n            return self.env.action_space.sample()\n\n\nCreate an environment using OpenAI Gym_:\n\n.. code:: python\n\n    import gym\n\n    env = gym.make('CartPole-v0')\n\nInitialize your agent using the environment:\n\n.. code:: python\n\n    agent = RandomAgent(env=env)\n\nNow you can start training your agent (in this example, the agent acts randomly always and doesn't learn anything):\n\n.. code:: python\n\n    scores = agent.train(episodes=100)\n\nYou can also visualize how the training progresses but it will slow down the process:\n\n.. code:: python\n\n    scores = agent.train(episodes=100, render=True)\n\nOnce you are done with the training, you can test it:\n\n.. code:: python\n\n    scores = agent.test(episodes=10)\n\nAlternatively, visualize how it performs:\n\n.. code:: python\n\n    scores = agent.test(episodes=10, render=True)\n\nTo learn more about how to build an agent that learns see agents_ documentation.\n\nSee examples_ directory to see implementations of some algorithms (DQN, A3C, PPO etc.) created using TensorFlow, PyTorch and NN_ libraries.\n\nInstallation\n************\n\nRequirements:\n\n-   Python \u003e= 3.6\n\nInstall from PyPI (recommended):\n\n::\n\n    pip install train\n\nAlternatively, install from source:\n\n::\n\n    git clone https://github.com/marella/train.git\n    cd train\n    pip install -e .\n\nTo run examples and tests, install from source.\n\nOther libraries such as Gym_, TensorFlow_, PyTorch_ and NN_ should be installed separately.\n\nExamples\n********\n\nTo run examples, install TensorFlow_, PyTorch_ and install other dependencies:\n\n::\n\n    pip install -e .[examples]\n\nand run an example in examples_ directory:\n\n::\n\n    cd examples\n    python PPO.py\n\nTesting\n*******\n\nTo run tests, install dependencies:\n\n::\n\n    pip install -e .[tests]\n\nand run:\n\n::\n\n    pytest tests\n\n.. _agents: https://train.readthedocs.io/en/latest/agents.html\n.. _examples: https://github.com/marella/train/tree/master/examples\n.. _Gym: https://gym.openai.com/docs/\n.. _TensorFlow: https://www.tensorflow.org/install\n.. _PyTorch: https://pytorch.org/get-started\n.. _NN: https://github.com/marella/nn\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarella%2Ftrain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarella%2Ftrain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarella%2Ftrain/lists"}