def __init__()

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


    def __init__(self, random_state=0, noise=0., n_actions=4, n_features=4, bound_context=1):
        self.bound_context = bound_context
        thetas = np.abs(np.random.randn(n_actions, n_features-1))
        super(RandomContextualLinearArms, self).__init__(random_state=random_state, noise=noise,
                                                         thetas=thetas)
        self.context_lists = []
        self.n_user = 5
        self.n = self.n_user
        thetas = np.ones((n_actions, n_features))
        thetas[:, :-1] = self.thetas.copy()
        max_rwd = -float('inf')
        min_rwd = float('inf')
        for k in range(self.n_user):
            test = np.abs(np.random.randn(self.n_features))
            test = np.random.uniform(low=0, high=bound_context)*test/np.linalg.norm(test)
            dot_prod = np.dot(self.thetas, test)
            maxi = np.max(dot_prod)
            mini = np.min(dot_prod)
            if maxi >= max_rwd:
                max_rwd = maxi
            if mini <= min_rwd:
                min_rwd = mini
            self.context_lists.append(np.concatenate((test, np.array([1]))))
        self.thetas = thetas
        thetas[:, -1] = -min_rwd + 1
        thetas = thetas / (max_rwd - min_rwd + 1)
        self.thetas = thetas
        print('Different Means:')
        for k in range(self.n_user):
            print('Means for context {}'.format(k), np.dot(thetas, self.context_lists[k]))
        self.theta = self.thetas