Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
X = np.random.binomial(1, .8, size=(n, d))
T = np.hstack([np.random.binomial(1, .5 * X[:, 0] + .25,
size=(n,)).reshape(-1, 1) for _ in range(d_t)])
true_coef = np.hstack([np.hstack([it + np.arange(p).reshape(-1, 1),
it + np.ones((p, 1)), np.zeros((p, d_x - 1))])
for it in range(d_t)])
def true_effect(x, t):
return cross_product(
np.hstack([np.ones((x.shape[0], 1)), x[:, :d_x]]), t) @ true_coef.T
y = true_effect(X, T) + X[:, [0] * p] +\
(hetero_coef * X[:, [0]] + 1) * np.random.normal(0, 1, size=(n, p))
XT = np.hstack([X, T])
X1, X2, y1, y2, X_final_first, X_final_sec, y_sum_first, y_sum_sec,\
n_sum_first, n_sum_sec, var_first, var_sec = _summarize(XT, y)
X = np.vstack([X1, X2])
y = np.concatenate((y1, y2))
X_final = np.vstack([X_final_first, X_final_sec])
y_sum = np.concatenate((y_sum_first, y_sum_sec))
n_sum = np.concatenate((n_sum_first, n_sum_sec))
var_sum = np.concatenate((var_first, var_sec))
first_half_sum = len(y_sum_first)
first_half = len(y1)
for cov_type in cov_type_list:
class SplitterSum:
def __init__(self):
return
def split(self, X, T):
return [(np.arange(0, first_half_sum),
np.arange(first_half_sum, X.shape[0])),