def method_instance(self): if not hasattr(self, "_method_instance"): n, p = self.X.shape self._method_instance = lasso_full.gaussian( self.X, self.Y, self.lagrange * np.sqrt(n)) self._method_instance.sparse_inverse = True return self._method_instance
def test_gaussian_full(n=100, p=20): y = np.random.standard_normal(n) X = np.random.standard_normal((n, p)) lam_theor = np.mean( np.fabs(np.dot(X.T, np.random.standard_normal((n, 1000)))).max(0)) Q = rr.identity_quadratic(0.01, 0, np.ones(p), 0) weights_with_zeros = 0.5 * lam_theor * np.ones(p) weights_with_zeros[:3] = 0. L = lasso_full.gaussian(X, y, weights_with_zeros, 1., quadratic=Q) L.fit() print(L.summary(compute_intervals=True))