This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
import numpy as np | |
from scipy import linalg | |
from scikits.learn.linear_model import Lasso, lars_path | |
from joblib import Parallel, delayed | |
################################################################################ | |
# Utilities to spread load on CPUs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np, scipy, scipy.sparse, numpy.linalg, scipy.optimize | |
from scipy import weave | |
def project_l1(lbda, sigma): | |
"Project positive vector lbda to have l1 norm sigma" | |
ll = -np.sort(-lbda) | |
cs = 0. | |
theta = 0 | |
prevtheta = 0 |