readme: ---
  library_name: stable-baselines3
  tags:
  - LunarLander-v2
  - deep-reinforcement-learning
  - reinforcement-learning
  - stable-baselines3
  model-index:
  - name: PPO
    results:
    - task:
        type: reinforcement-learning
        name: reinforcement-learning
      dataset:
        name: LunarLander-v2
        type: LunarLander-v2
      metrics:
      - type: mean_reward
        value: 239.92 +/- 20.79
        name: mean_reward
        verified: false
  ---
  
  # **PPO** Agent playing **LunarLander-v2**
  This is a trained model of a **PPO** agent playing **LunarLander-v2**
  using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3).
  
  ## Usage (with Stable-baselines3)
  
  ```python
  #create enviroment
  env = gym.make('LunarLander-v2')
  
  #reset enviroment ot initial state
  env.reset()
  
  #create vectorized enviroment
  env = make_vec_env("LunarLander-v2", n_envs=16)
  
  #instanciate the agent
  #params: https://stable-baselines3.readthedocs.io/en/master/modules/ppo.html#parameters
  model = PPO('MlpPolicy',env,verbose=1,
              learning_rate=0.0003,
              # n_steps=2048,
              n_steps=1024,
              batch_size=64,
              # n_epochs=10,
              n_epochs=4,
              # gamma=0.99,
              gamma=0.999,
              # gae_lambda=0.95,
              gae_lambda=0.98,
              clip_range=0.2,
              clip_range_vf=None,
              normalize_advantage=True,
              # ent_coef=0.0,
              ent_coef=0.01
              # vf_coef=0.5,
              # max_grad_norm=0.5,
              # use_sde=False,
              # sde_sample_freq=-1,
              # target_kl=None,
              # tensorboard_log=None,
              # policy_kwargs=None,
              # verbose=0,
              # seed=seed,
              # device='auto',
              # _init_setup_model=True           
              )
  
  #train model
  model.learn(total_timesteps=int(1e6))
  
  ...
  ```
  