Downloads · 30 days
0
Nharen/Reward_Rush_Q-learning_Taxi
Reward_Rush_Q-learning_Taxi is a reinforcement learning model from Nharen. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains a tabular Q-learning agent for the Taxi-v3 environment.
Downloads · 30 days
0
Access
Public
Updated Dec 31, 2025
Repo size
24.2 KB
Likes
0
Public
Click a slice to open those files.
.mp493.4 KB · 77%
From the Hugging Face model README
This repository contains a tabular Q-learning agent for the Taxi-v3 environment.
The model uses a discrete Q-table with the following specifications:
import gymnasium as gym
import numpy as np
import pickle
from huggingface_hub import hf_hub_download
def run_taxi_test():
path = hf_hub_download(repo_id="Nharen/Reward_Rush_Q-learning_Taxi", filename="q-learning.pkl")
with open(path, "rb") as f:
q_table = pickle.load(f)
env = gym.make("Taxi-v3")
total_success = 0
num_episodes = 100
for _ in range(num_episodes):
state, _ = env.reset()
done = False
while not done:
action = np.argmax(q_table[state])
state, reward, terminated, truncated, _ = env.step(action)
done = terminated or truncated
if terminated and reward == 20:
total_success += 1
print(f"Success Rate: {total_success}/{num_episodes}")
env.close()
if __name__ == "__main__":
run_taxi_test()