1
$\begingroup$

Is anyone aware of a scikit-compatible network Lasso (nLasso) implementation?

These papers have source code as well:

D. Hallac, J. Leskovec, and S. Boyd, “Network lasso: Clustering and optimization in large graphs,” in Proc. SIGKDD, 2015, pp. 387–396.

Code: https://riken-yamada.github.io/localizedlasso.html

[2] M.Yamada, T. Koh, T. Iwata, J. Shawe-Taylor, and S. Kaski, “Localized Lasso for High-Dimensional Regression,” in Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, vol. 54. Fort Lauderdale, FL, USA: PMLR, Apr. 2017, pp. 325–333.

Code: https://github.com/davidhallac/NetworkLasso

But these particular implementations are not very general and can't be used as a part of the pipelines.

I would like to use nLasso to do something like this (the example picked from the scikit tutorial):

import matplotlib.pyplot as plt
import numpy as np

from sklearn.datasets import load_boston
from sklearn.feature_selection import SelectFromModel
from sklearn.linear_model import LassoCV

# Load the boston dataset.
boston = load_boston()
X, y = boston['data'], boston['target']

# We use the base estimator LassoCV since the L1 norm promotes sparsity of features.
clf = LassoCV(cv=5)

# Set a minimum threshold of 0.25
sfm = SelectFromModel(clf, threshold=0.25)
sfm.fit(X, y)
n_features = sfm.transform(X).shape[1]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.