Skip to main content

GridMind 🧠

Upload Python Package

GridMind is a library of reinforcement learning (RL) algorithms. This library prioritizes tabular implementations to enhance understanding and facilitate hands-on experimentation with learning patterns in various RL algorithms. GridMind is compatible with gymnasium environments, making it easy to integrate with a wide range of standard RL environments.

This library is also designed to serve as a companion for readers of the book Reinforcement Learning: An Introduction (2nd ed.) by Richard S. Sutton and Andrew G. Barto.

Note: GridMind is a work in progress and will be updated with additional algorithms and features over time.


📜 Algorithms Included

Tabular

1. Monte Carlo Methods

  • Every-Visit MC: Prediction
  • Exploring Starts: Prediction & Control
  • Off-Policy MC: Prediction & Control

2. Temporal Difference (TD) Methods

  • TD(0): Prediction
  • SARSA: Control
  • Q-Learning: Control

3. N-Step Methods

  • N_Step TD Prediction: Prediction
  • N_Step SARSA: Control

Function Approximation

  • Semi-gradient TD-0 Prediction: Prediction
  • Gradient Monte-Carlo Prediction: Prediction
  • Episodic Semi-gradient SARSA: Control
Demo

Figure: GridMind on different environments.


Documentation

https://gridmind.readthedocs.io/en/latest/

Getting Started 🚀

To use GridMind, you’ll need:

  • Python (>= 3.8)
  1. Installation: Clone the repository and install the package with the following commands:

    git clone https://github.com/shuvoxcd01/GridMind.git
    cd GridMind
    pip install .
    

    Or, install it from PyPI:

    pip install gridmind
    
  2. Basic Usage:

    from gridmind.algorithms.tabular.temporal_difference.control.q_learning import QLearning
    import gymnasium as gym
    
    # Initialize the Taxi-v3 environment
    env = gym.make("Taxi-v3")
    agent = QLearning(env=env)
    
    # Train the agent
    agent.optimize_policy(num_episodes=10000)
    
    # Get the learned policy
    policy = agent.get_policy()
    
    # Close and re-open the environment for rendering
    env.close()
    env = gym.make("Taxi-v3", render_mode="human")
    
    # Demonstrate the policy
    obs, _ = env.reset()
    for step in range(100):
        action = policy.get_action_deterministic(state=obs)
        next_obs, reward, terminated, truncated, _ = env.step(action=action)
        print("Reward: ", reward)
        obs = next_obs
        env.render()
    
        if terminated or truncated:
            obs, _ = env.reset()
    
    env.close()
    

🌍 Contribution

Contributions are welcome! Whether it’s bug fixes, new features, or suggestions, feel free to open an issue or submit a pull request. We appreciate the community's input in making GridMind a valuable learning resource for all.

Metadata

Release files for gridmind 0.0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gridmind 0.0.7.1
File Size Uploaded
gridmind-0.0.7.1.tar.gz 49.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gridmind 0.0.7.1
File Interpreter ABI Platform
gridmind-0.0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 144.5 kB

Release files / gridmind-0.0.7.1.tar.gz

Download URL gridmind-0.0.7.1.tar.gz
Size 49.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d95291c6eeadbf762729424bec08c88c0afba0b496d4ebf2ed269be47b948f2d
BLAKE2b-256 checksum
How to use checksums
79998b59af4c038c55bda9f2511ceccc0b2f2763aa4847affa7ffaafa35ba193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / gridmind-0.0.7.1-py3-none-any.whl

Download URL gridmind-0.0.7.1-py3-none-any.whl
Size 95.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44e2a17d4685875b5ebe8b88b349a8f2635bc25f4c6d62b2b3c0258b25e9c5f9
BLAKE2b-256 checksum
How to use checksums
4041a158c40f101f9fc07e166d8bd3a1b372c6fe0b3c4ab0647afb15e18b2320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.0.7.1 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page