Kayıtlar

Reinforcement Learning

Resim
  import time from collections import deque, namedtuple import gym import numpy as np import PIL.Image import tensorflow as tf import utils from pyvirtualdisplay import Display from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, Input from tensorflow.keras.losses import MSE from tensorflow.keras.optimizers import Adam # Set up a virtual display to render the Lunar Lander environment. Display(visible=0, size=(840, 480)).start(); # Set the random seed for TensorFlow tf.random.set_seed(utils.SEED) env = gym.make('LunarLander-v2') env.reset() PIL.Image.fromarray(env.render(mode='rgb_array')) state_size = env.observation_space.shape num_actions = env.action_space.n print('State Shape:', state_size) print('Number of actions:', num_actions) # Reset the environment and get the initial state. current_state = env.reset() # Create the Q-Network q_network = Sequential([     Input(shape=state_size),     Dense(units=64, activation='r...