def compute_bench(samples_range, features_range):
    it = 0
    results = defaultdict((lambda : []))
    max_it = (len(samples_range) * len(features_range))
    for n_samples in samples_range:
        for n_features in features_range:
            it += 1
            print('====================')
            print(('Iteration %03d of %03d' % (it, max_it)))
            print('====================')
            dataset_kwargs = {'n_samples': n_samples, 'n_features': n_features, 'n_informative': (n_features // 10), 'effective_rank': (min(n_samples, n_features) / 10), 'bias': 0.0}
            print(('n_samples: %d' % n_samples))
            print(('n_features: %d' % n_features))
            (X, y) = make_regression(**dataset_kwargs)
            gc.collect()
            print('benchmarking lars_path (with Gram):', end='')
            sys.stdout.flush()
            tstart = time()
            G = np.dot(X.T, X)
            Xy = np.dot(X.T, y)
            lars_path_gram(Xy=Xy, Gram=G, n_samples=y.size, method='lasso')
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lars_path (with Gram)'].append(delta)
            gc.collect()
            print('benchmarking lars_path (without Gram):', end='')
            sys.stdout.flush()
            tstart = time()
            lars_path(X, y, method='lasso')
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lars_path (without Gram)'].append(delta)
            gc.collect()
            print('benchmarking lasso_path (with Gram):', end='')
            sys.stdout.flush()
            tstart = time()
            lasso_path(X, y, precompute=True)
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lasso_path (with Gram)'].append(delta)
            gc.collect()
            print('benchmarking lasso_path (without Gram):', end='')
            sys.stdout.flush()
            tstart = time()
            lasso_path(X, y, precompute=False)
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lasso_path (without Gram)'].append(delta)
    return results
def compute_bench(samples_range, features_range):
    it = 0
    results = defaultdict((lambda : []))
    max_it = (len(samples_range) * len(features_range))
    for n_samples in samples_range:
        for n_features in features_range:
            it += 1
            print('====================')
            print(('Iteration %03d of %03d' % (it, max_it)))
            print('====================')
            dataset_kwargs = {'n_samples': n_samples, 'n_features': n_features, 'n_informative': (n_features // 10), 'effective_rank': (min(n_samples, n_features) / 10), 'bias': 0.0}
            print(('n_samples: %d' % n_samples))
            print(('n_features: %d' % n_features))
            (X, y) = make_regression(**dataset_kwargs)
            gc.collect()
            print('benchmarking lars_path (with Gram):', end=)
            sys.stdout.flush()
            tstart = time()
            G = np.dot(X.T, X)
            Xy = np.dot(X.T, y)
            lars_path_gram(Xy=Xy, Gram=G, n_samples=y.size, method='lasso')
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lars_path (with Gram)'].append(delta)
            gc.collect()
            print('benchmarking lars_path (without Gram):', end=)
            sys.stdout.flush()
            tstart = time()
            lars_path(X, y, method='lasso')
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lars_path (without Gram)'].append(delta)
            gc.collect()
            print('benchmarking lasso_path (with Gram):', end=)
            sys.stdout.flush()
            tstart = time()
            lasso_path(X, y, precompute=True)
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lasso_path (with Gram)'].append(delta)
            gc.collect()
            print('benchmarking lasso_path (without Gram):', end=)
            sys.stdout.flush()
            tstart = time()
            lasso_path(X, y, precompute=False)
            delta = (time() - tstart)
            print(('%0.3fs' % delta))
            results['lasso_path (without Gram)'].append(delta)
    return results