{"id":24310314,"url":"https://github.com/gahogg/rl_learn","last_synced_at":"2025-09-26T15:31:34.358Z","repository":{"id":57462155,"uuid":"268599590","full_name":"gahogg/rl_learn","owner":"gahogg","description":"A package to accompany the book \"Reinforcement Learning: A Python Introduction\"","archived":false,"fork":false,"pushed_at":"2021-01-17T23:14:36.000Z","size":251,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-15T02:56:43.032Z","etag":null,"topics":["numpy","python","reinforcement-learning","reinforcement-learning-algorithms","reinforcement-learning-environments"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gahogg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-01T18:22:42.000Z","updated_at":"2022-07-19T21:40:25.000Z","dependencies_parsed_at":"2022-09-10T04:02:18.841Z","dependency_job_id":null,"html_url":"https://github.com/gahogg/rl_learn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gahogg%2Frl_learn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gahogg%2Frl_learn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gahogg%2Frl_learn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gahogg%2Frl_learn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gahogg","download_url":"https://codeload.github.com/gahogg/rl_learn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234319576,"owners_count":18813552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["numpy","python","reinforcement-learning","reinforcement-learning-algorithms","reinforcement-learning-environments"],"created_at":"2025-01-17T06:11:14.249Z","updated_at":"2025-09-26T15:31:34.016Z","avatar_url":"https://github.com/gahogg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rl_learn\nrl-learn is a Python package that teaches fundamental reinforcement learning techniques in Python. It closely follows Sutton and Barto’s famous “Reinforcement Learning: An Introduction”.\n\nLink to the PyPi page: https://pypi.org/project/rl-learn/\n\n1. (Optional, highly recommended) Create an isolated Python virtual environment for using the library using venv: https://docs.python.org/3/library/venv.html\n\n2. After activating the virtual environment, \"pip install rl-learn\" should grab the updated package from PyPi.\n\n3. View (and optionally run) the example code shown below. It should produce a pdf showing the performance of some bandit agents.\n\n4. Browse through the code in the GitHub browser or example code below to see how to get different (already implemented agents) to interact with other environments. Note that when the comments specify \"... defines an interface\" that these are not concrete implementations - they instead describe an interface that must be implemented. Also note that Contextual agents/bandits can only interact with their contextual counterparts - the others should be free to \"mix and match\", though.\n\n5. The required reading to understand everything should be Sutton and Barto's Reinforcement Learning: An Introduction, Edition 2, all of chapter 2.\n\nExample Code:\n\n```python\nfrom rl_learn.bandits.environments import KArmedTestbed\nfrom rl_learn.bandits.agents import GradientAgent, UCBAgent\nfrom rl_learn.bandits.interaction import assess_and_plot\n\n# Create Gradient and UCB agents, and a description for them\nagents = GradientAgent(), UCBAgent()\nlegend = [\"Gradient Agent\", \"UCB Agent\"]\n\n# Define a k-armed bandit problem for the agents to interact with\nenv = KArmedTestbed()\n\n# Run the interactions and plot the average rewards per timestep\nassess_and_plot(env=env,\n                agents=agents,\n                file_name=\"example\",\n                legend=legend)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgahogg%2Frl_learn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgahogg%2Frl_learn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgahogg%2Frl_learn/lists"}