Skip to content

Commit

Permalink
ensure random_state is used
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximilianFranz committed Jan 16, 2020
1 parent 9e672c8 commit 91ed69c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/justcause/data/generators/ihdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
OptRandState = Optional[Union[int, RandomState]]


def _multi_modal_effect(covariates):
def _multi_modal_effect(covariates, random_state):
prob = expit(covariates[:, 7]) > 0.5
return np.random.normal((3 * prob) + 1 * (1 - prob), 0.1)
return random_state.normal((3 * prob) + 1 * (1 - prob), 0.1)


def _exponential_effect(covariates):
Expand All @@ -33,7 +33,7 @@ def _exponential_effect(covariates):
def _multi_outcome(covariates, *, random_state: RandomState, **kwargs):
random_state = check_random_state(random_state)
y_0 = random_state.normal(0, 0.2, size=len(covariates))
y_1 = y_0 + _multi_modal_effect(covariates)
y_1 = y_0 + _multi_modal_effect(covariates, random_state)
mu_0, mu_1 = y_0, y_1
return mu_0, mu_1, y_0, y_1

Expand Down

0 comments on commit 91ed69c

Please sign in to comment.