Skip to content

Commit

Permalink
non-norm simulation finalized
Browse files Browse the repository at this point in the history
  • Loading branch information
spisakt committed Oct 11, 2021
1 parent a706bc4 commit 3a7ed6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions mlconfound/simulate.py
Expand Up @@ -150,11 +150,13 @@ def simulate_y_c_yhat(w_yc,
rng = np.random.default_rng(random_state)
y = rng.normal(0, 1, n)

c = np.array([rng.normal(w_yc * nonlin_trf_fun(yi), 1, 1) for yi in y]).flatten()
c = _scale(c)

yhat = sinh_arcsinh(np.array([rng.normal(w_yyhat * nonlin_trf_fun(yi) + w_cyhat * nonlin_trf_fun(ci), 1, 1)
for yi, ci in zip(y, c)]).flatten(), delta=delta, epsilon=epsilon)
yhat = _scale(yhat)
c = np.array([sinh_arcsinh(rng.normal(0, 1, 1), delta=delta, epsilon=epsilon) + w_yc * nonlin_trf_fun(yi) for yi in y]).flatten()
if scale:
c = _scale(c)

yhat = np.array([sinh_arcsinh(rng.normal(0, 1, 1), delta=delta, epsilon=epsilon) + w_yyhat * nonlin_trf_fun(yi) + w_cyhat * nonlin_trf_fun(ci)
for yi, ci in zip(y, c)]).flatten()
if scale:
yhat = _scale(yhat)

return y, c, yhat
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mlconfound"
version = "0.12.0"
version = "0.13.0"
description = "Tools for analyzing and quantifying effects of counfounder variables on machine learning model predictions."
authors = ["Tamas Spisak <tamas.spisak@uni-due.de>"]
license = "GPL-3.0-or-later"
Expand Down

0 comments on commit 3a7ed6b

Please sign in to comment.