I have started learning reinforcement learning and as a part of it I am exploring the action selection strategies available. I am comparing epsilon-greedy vs boltzmann exploration(softmax exploration). I have understood and implemented epsilon greedy the follwing way.

def get_action(state, episode):
# get action from model using epsilon-greedy policy
# Decay in ε after we generate each sample from the environment
    epsilon = epsilon_min + (epsilon_max - epsilon_min) * np.exp(-epsilon_decay*episode / 4)

    if np.random.rand() <= epsilon: # Exploration: randomly choosing and action      
        action = [round(random.uniform(0.3, 1.0), 2), round(random.uniform(0.3, 1.0), 2)]

    else: #Exploitation: this gets the action corresponding to max q-value of current state
        state_encod = np.reshape(state, [1, state_size])
        q_values = model.predict(state_encod)
        action = np.argmax(q_values)

    return action, epsilon

I am not completely fluent with boltzmann and facing difficulty with implementation. can some one help me with this implementation. Tried a lot but couldn't. Really stuck at this.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.