def generate_outcomes(self, x, a, z):
     y0_prob = np.expand_dims(
         sigmoid(np.mean(x, axis=1) / self.outcome_scale), 1)
     y1_prob = np.expand_dims(
         sigmoid(-np.mean(x, axis=1) / self.outcome_scale), 1)
     y0 = np.random.binomial(1, y0_prob)
     y1 = np.random.binomial(1, y1_prob)
     return y0, y1, y0_prob, y1_prob
 def generate_outcomes(self, x, a, z):
     mn = np.mean(x, axis=1)
     logit_below_0 = mn / self.outcome_scale
     logit_above_0 = (mn + self.offset) / self.outcome_scale
     logits = switch(logit_below_0, logit_above_0, mn > 0)
     y0_prob = np.expand_dims(sigmoid(logits), 1)
     y1_prob = np.expand_dims(sigmoid(-logits), 1)
     y0 = np.random.binomial(1, y0_prob)
     y1 = np.random.binomial(1, y1_prob)
     return y0, y1, y0_prob, y1_prob
 def choose_observed_treatment(self, x, a, z):
     # A = 0 treatment
     a0_t_obs_prob = np.expand_dims(
         sigmoid(np.mean(x + z, axis=1) / self.outcome_scale), 1)
     a0_t_obs = np.random.binomial(1, a0_t_obs_prob)
     a0_t_obs_cf = 1 - a0_t_obs
     # A = 1 treatment
     a1_t_obs_prob = np.expand_dims(
         sigmoid(np.mean(x - z, axis=1) / self.outcome_scale), 1)
     a1_t_obs = np.random.binomial(1, a1_t_obs_prob)
     a1_t_obs_cf = 1 - a1_t_obs
     #combine outcomes by A
     t_obs = switch(a0_t_obs, a1_t_obs, a)
     t_obs_prob = switch(a0_t_obs_prob, a1_t_obs_prob, a)
     t_obs_cf = switch(a0_t_obs_cf, a1_t_obs_cf, a)
     return t_obs, t_obs_cf, t_obs_prob
 def generate_outcomes(self, x, a, z):
     #A = 0 outcomes
     a0_y0_prob = np.expand_dims(
         sigmoid(np.mean(x + z, axis=1) / self.outcome_scale), 1)
     a0_y1_prob = np.expand_dims(
         sigmoid(-np.mean(x - z, axis=1) / self.outcome_scale), 1)
     a0_y0 = np.random.binomial(1, a0_y0_prob)
     a0_y1 = np.random.binomial(1, a0_y1_prob)
     #A = 1 outcomes
     a1_y0_prob = np.expand_dims(
         sigmoid(np.mean(x - z, axis=1) / self.outcome_scale), 1)
     a1_y1_prob = np.expand_dims(
         sigmoid(-np.mean(x + z, axis=1) / self.outcome_scale), 1)
     a1_y0 = np.random.binomial(1, a1_y0_prob)
     a1_y1 = np.random.binomial(1, a1_y1_prob)
     #combine outcomes by A
     y0 = switch(a0_y0, a1_y0, a)
     y1 = switch(a0_y1, a1_y1, a)
     y0_prob = switch(a0_y0_prob, a1_y0_prob, a)
     y1_prob = switch(a0_y1_prob, a1_y1_prob, a)
     return y0, y1, y0_prob, y1_prob
def generate_outcomes(x):
    y0_prob = np.expand_dims(sigmoid(np.sum(x, axis=1) / 5.), 1)
    y1_prob = np.expand_dims(sigmoid(-np.sum(x, axis=1) / 5.), 1)
    y0 = np.random.binomial(1, y0_prob)
    y1 = np.random.binomial(1, y1_prob)
    return y0, y1, y0_prob, y1_prob
def choose_observed_treatment(x):
    t_obs_prob = np.expand_dims(sigmoid(np.sum(x, axis=1) / 5.), 1)
    t_obs = np.random.binomial(1, t_obs_prob)
    t_obs_cf = 1 - t_obs
    return t_obs, t_obs_cf, t_obs_prob
 def choose_observed_treatment(self, x, a, z):
     t_obs_prob = np.expand_dims(
         sigmoid(np.mean(x, axis=1) / self.outcome_scale), 1)
     t_obs = np.random.binomial(1, t_obs_prob)
     t_obs_cf = 1 - t_obs
     return t_obs, t_obs_cf, t_obs_prob