I have an actor-critic network. The state space contains continuous variables with different ranges like (0,1.57) and (-0.70, 0.70). And it also contain absolute 6D pose in the form (x,y,z,roll,pitch,yaw). The action space is continuous too in the range (0, 1.57). I apply scaling at the input layer, and scale things back before applying the action received from network. Irrespective of learning for 100 or 1000 episodes, the actor model always gives either -1 or 1. Eg: [1,1,-1,-1] which gets scaled to [1.57,1.57,-1.57,-1.57] as an action vector. Could someone give me suggestion on what's happening with the network. The learning follows DDPG algorithm.
actor_lr = 0.0001
critic_lr = 0.001
def actor(state_size, action_size):
inputs = Input(shape=(state_size,), name="state_space")
layer_one = Dense(300, activation="relu")(inputs)
layer_two = Dense(400, activation="relu")(layer_one)
outputs = Dense(action_size, activation="tanh", name="action_space")(layer_two)
model = Model(inputs = inputs, outputs = outputs)
model.compile(loss="mse", optimizer=Adam(lr=actor_lr), metrics=["accuracy"])
return model
def get_critic(state_size, action_size):
state_input = Input(shape=(state_size), name="state_space")
state_out = Dense(64, activation="relu")(state_input)
action_input = Input(shape=(action_size), name="actions_sapce")
action_out = Dense(18, activation="relu")(action_input)
concat = Concatenate()([state_out, action_out])
critic_layer_one = Dense(300, activation="relu", kernel_regularizer=regularizers.l2(0.01))(concat)
critic_layer_two = Dense(400, activation="relu", kernel_regularizer=regularizers.l2(0.01))(critic_layer_one)
outputs = Dense(1, activation="linear", kernel_regularizer=regularizers.l2(0.01))(critic_layer_two)
model = Model([state_input, action_input], outputs, name = name)
model.compile(loss="mse", optimizer=Adam(lr=critic_lr), metrics=["accuracy"])
return model