Downloads · 30 days
0
Tejas-Anvekar/Qtable_taxi-v3
Qtable_taxi-v3 is a reinforcement learning model from Tejas-Anvekar. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product.
This is a trained Q-Learning agent playing Taxi-v3. The agent was trained using a custom implementation of the Q-Learning algorithm.
Downloads · 30 days
0
Access
Public
Updated Jan 6, 2026
Repo size
147 KB
Likes
0
Public
Click a slice to open those files.
.mp4123 KB · 81%
From the Hugging Face model README
This is a trained Q-Learning agent playing Taxi-v3. The agent was trained using a custom implementation of the Q-Learning algorithm.
Taxi-v3| Metric | Value |
|---|---|
| Mean Reward | 7.56 +/- 2.71 |
| Evaluation Episodes | 100 |
The agent was trained using the following hyperparameters:
To use this model, you need gymnasium and pickle5 installed. You can load the model and evaluate it using the code below:
import gymnasium as gym
import pickle5 as pickle
import numpy as np
from huggingface_hub import hf_hub_download
# 1. Download the model file from the Hub
repo_id = "Tejas-Anvekar/Qtable_taxi-v3"
filename = "q-learning.pkl"
pickle_model = hf_hub_download(repo_id=repo_id, filename=filename)
# 2. Load the model configuration and Q-table
with open(pickle_model, 'rb') as f:
model = pickle.load(f)
# 3. Create the environment
env = gym.make(model["env_id"], render_mode="rgb_array")
# 4. Define the Greedy Policy
def greedy_policy(Qtable, state):
action = np.argmax(Qtable[state][:])
return action
# 5. Evaluate the agent
state, info = env.reset()
terminated = False
truncated = False
total_reward = 0
print("Agent is playing...")
while not terminated and not truncated:
action = greedy_policy(model["qtable"], state)
next_state, reward, terminated, truncated, info = env.step(action)
total_reward += reward
state = next_state
print(f"Game Finished! Total Reward: {total_reward}")
env.close()