PPO Agent playing LunarLander-v2

This is a trained model of a PPO agent playing LunarLander-v2 using the stable-baselines3 library.

Usage (with Stable-baselines3)


#----------------Create environment----------------
import gymnasium as gym

env = gym.make('LunarLander-v2')
env.reset()

#----------------Create the Model----------------
from stable_baselines3 import PPO
from stable_baselines3.ppo import MlpPolicy
model = PPO('MlpPolicy',env, verbose=1)
model.learn(total_timesteps=1000000)
model_name = "ppo-LunarLander-v2"
model.save(model_name)

#----------------Evaluate the agent-----------------
from stable_baselines3.common.evaluation import evaluate_policy
from stable_baselines3.common.monitor import Monitor
import gymnasium as gym

# Create a new environment for evaluation
eval_env = Monitor(gym.make("LunarLander-v2", render_mode='rgb_array'))
# Evaluate the model 
mean_reward, std_reward = evaluate_policy(model, eval_env, n_eval_episodes=10, deterministic=True)
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")

...
Downloads last month
-
Video Preview
loading

Evaluation results