Last active
July 23, 2020 02:21
-
-
Save a-mitani/4758898e133b7938cba615e6c950769f to your computer and use it in GitHub Desktop.
交互作用を含むトイデータの生成
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_toy_dataset(n=100): | |
# 交互作用を含まない変数 | |
ind_vars = np.random.randn(n, 2) | |
# 交互作用のもとになる変数 | |
int_var_src = np.random.randn(n, 2) | |
X = np.hstack([ind_vars, int_var_src]) | |
y = ind_vars[:, 1] + 2 * int_var_src[:, 0] * int_var_src[:, 1] | |
return X, y | |
X, y = create_toy_dataset(2000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment