This is a piece of code from my homework.
# action policy: implements epsilon greedy and softmax
def select_action(self, state, epsilon):
qval = self.qtable[state]
prob = []
if (self.softmax):
# use Softmax distribution
prob = sp.softmax(qval / epsilon)
#print(prob)
else:
# assign equal value to all actions
prob = np.ones(self.actions) * epsilon / (self.actions -1)
# the best action is taken with probability 1 - epsilon
prob[np.argmax(qval)] = 1 - epsilon
return np.random.choice(range(0, self.actions), p = prob)
This is a method in order to select the best action according to the two polices i think. My question is, why in the softmax computation there is the epsilon parameter used as temperature. Is really the same thing? Are they different? I think they should be two different variables. Should the temperature be a fixed value over time? Because when i use the epsilon-greedy policy my epsilon decrease over time.