1 comment

[ 2.8 ms ] story [ 9.8 ms ] thread
Always useful to see implementations of simple components, like epsilon greedy action choice:

    function nql:eGreedy(state, testing_ep)
        self.ep = testing_ep or (self.ep_end +
                    math.max(0, (self.ep_start - self.ep_end) * (self.ep_endt -
                    math.max(0, self.numSteps - self.learn_start))/self.ep_endt))
        -- Epsilon greedy
        if torch.uniform() < self.ep then
            return torch.random(1, self.n_actions)
        else
            return self:greedy(state)
        end
    end