def ml_problem(self): np.random.seed(0) X = np.random.standard_normal((self.num_rows, self.num_cols)) w = self.random_weights() y = np.argmax(_group_lasso._softmax(X @ w), axis=1) y = LabelBinarizer().fit_transform(y) return X, y, w
def sparse_ml_problem(self): X = sparse.random(self.num_rows, self.num_cols, random_state=0) X = sparse.dok_matrix(X) for row in range(self.num_rows): col = np.random.randint(self.num_cols) X[row, col] = np.random.standard_normal() w = self.random_weights() y = np.argmax(_group_lasso._softmax(X @ w), axis=1) y = LabelBinarizer().fit_transform(y) return X, y, w