def get_action()

in isoexp/contextual/contextual_linucb.py [0:0]


    def get_action(self, context):
        if self.nb_iter < self.K:
            return self.nb_iter
        else:
            # select the chosen_arm
            expected_rewards = self.thetas_hat.dot(context)

            rnd = np.random.rand()
            if rnd <= self.epsilon / (np.sqrt(self.nb_iter + 1) if self.decrease_epsilon else 1):
                chosen_arm = np.random.choice(self.K)
            else:
                noise = 10**-7*np.random.randn(self.K)
                chosen_arm = np.argmax(noise + expected_rewards)
            return chosen_arm