code: def test_lasso_lars_vs_lasso_cd_early_stopping():
      # Test that LassoLars and Lasso using coordinate descent give the
      # same results when early stopping is used.
      # (test : before, in the middle, and in the last part of the path)
      alphas_min = [10, 0.9, 1e-4]
  
      X = diabetes.data
  
      for alpha_min in alphas_min:
          alphas, _, lasso_path = linear_model.lars_path(
              X, y, method="lasso", alpha_min=alpha_min
          )
          lasso_cd = linear_model.Lasso(fit_intercept=False, tol=1e-8)
          lasso_cd.alpha = alphas[-1]
          lasso_cd.fit(X, y)
          error = linalg.norm(lasso_path[:, -1] - lasso_cd.coef_)
          assert error < 0.01
  
      # same test, with normalization
      X = diabetes.data - diabetes.data.sum(axis=0)
      X /= np.linalg.norm(X, axis=0)
  
      for alpha_min in alphas_min:
          alphas, _, lasso_path = linear_model.lars_path(
              X, y, method="lasso", alpha_min=alpha_min
          )
          lasso_cd = linear_model.Lasso(tol=1e-8)
          lasso_cd.alpha = alphas[-1]
          lasso_cd.fit(X, y)
          error = linalg.norm(lasso_path[:, -1] - lasso_cd.coef_)
          assert error < 0.01
  
imports: import warnings
  import numpy
  import pytest
  from scipy import linalg
  from sklearn import datasets, linear_model
  from sklearn.base import clone
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.linear_model import Lars, LarsCV, LassoLars, LassoLarsCV, LassoLarsIC, lars_path
  from sklearn.linear_model._least_angle import _lars_path_residues
  from sklearn.model_selection import train_test_split
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils._testing import TempMemmap, assert_allclose, assert_array_almost_equal, ignore_warnings
label_desc: Use image node_id 17 for calling a global function with example usage: test_lasso_lars_vs_lasso_cd_early_stopping() without return types