def meta_algorithm(X, XTXi, resid, sampler): S = sampler(scale=0.) # deterministic with scale=0 ynew = X.dot(XTXi).dot(S) + resid # will be ok for n>p and non-degen X G = lasso_glmnet(X, ynew, *[None] * 4) select = G.select() return set(list(select[0]))
def meta_algorithm(X, XTXi, resid, sampler): S = sampler.center.copy() ynew = X.dot(XTXi).dot(S) + resid # will be ok for n>p and non-degen X G = lasso_glmnet(X, ynew, *[None] * 4) select = G.select(seed=seed) return set(list(select[0]))
def meta_algorithm(X, XTXi, resid, sampler): n, p = X.shape idx = np.random.choice(np.arange(n), 200, replace=False) S = sampler(scale=0.) # deterministic with scale=0 ynew = X.dot(XTXi).dot(S) + resid # will be ok for n>p and non-degen X G = lasso_glmnet(X[idx], ynew[idx], *[None] * 4) select = G.select() return set(list(select[0]))
def meta_algorithm(X, XTXi, resid, sampler): n, p = X.shape S = sampler(scale=0.5) # deterministic with scale=0 ynew = X.dot(XTXi).dot(S) + resid # will be ok for n>p and non-degen X Xstack = np.hstack([X, np.random.standard_normal((n, k))]) G = lasso_glmnet(Xstack, ynew, *[None] * 4) select = G.select(seed=seed) return set(list(select[0])).intersection(range(p))