def _lasso_stability_path(X, y, mask, weights, eps):
 X = (X * weights[np.newaxis, :])
 X = X[safe_mask(X, mask), :]
 y = y[mask]
 alpha_max = (np.max(np.abs(np.dot(X.T, y))) / X.shape[0])
 alpha_min = (eps * alpha_max)
 with warnings.catch_warnings():
  warnings.simplefilter('ignore', ConvergenceWarning)
  (alphas, _, coefs) = lars_path(X, y, method='lasso', verbose=False, alpha_min=alpha_min)
 alphas /= alphas[0]
 alphas = alphas[::(-1)]
 coefs = coefs[:, ::(-1)]
 mask = (alphas >= eps)
 mask[0] = True
 alphas = alphas[mask]
 coefs = coefs[:, mask]
 return (alphas, coefs)

def _lasso_stability_path ( X , y , mask , weights , eps ) : X = ( X * weights [ np . newaxis , : ] ) X = X [ safe_mask ( X , mask ) , : ] y = y [ mask ] alpha_max = ( np . max ( np . abs ( np . dot ( X . T , y ) ) ) / X . shape [ 0 ] ) alpha_min = ( eps * alpha_max ) with warnings . catch_warnings ( ) : warnings . simplefilter ( 'ignore' , ConvergenceWarning ) ( alphas , _ , coefs ) = lars_path ( X , y , method = 'lasso' , verbose = False , alpha_min = alpha_min ) alphas /= alphas [ 0 ] alphas = alphas [ : : ( - 1 ) ] coefs = coefs [ : , : : ( - 1 ) ] mask = ( alphas >= eps ) mask [ 0 ] = True alphas = alphas [ mask ] coefs = coefs [ : , mask ] return ( alphas , coefs )
inner loop of lasso_stability_path .