Skip to main content

No project description provided

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gridmind-0.0.7.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gridmind-0.0.7-py3-none-any.whl (95.2 kB view details)

Uploaded Python 3

File details

Details for the file gridmind-0.0.7.tar.gz.

File metadata

  • Download URL: gridmind-0.0.7.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for gridmind-0.0.7.tar.gz
Algorithm Hash digest
SHA256 779944171080b587d14ba1e42d2e6aab73a9de81fac0bd9345471ec9ac9d4de7
MD5 6c45d5d96241b78e37030e51a5cf3706
BLAKE2b-256 f03e62bf9f410c710cdaf88559e63fdf4e4f88fbcdcc3bb2079e3e1ba20d7316

See more details on using hashes here.

File details

Details for the file gridmind-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: gridmind-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 95.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for gridmind-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3c6ade1b2d2300e04961617c1c41b3a1bf6775550a076b3d403459265b3ebefd
MD5 b26690138bd89c347e5ae3cb6ce2c8fc
BLAKE2b-256 8e0fbf2009b2176a52f04f9aa1606a0329a556e14dfd0cf9a0ecb8e023af7090

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page