code: def test_lin_reg_sklearn_l1_non_regression():
      """Checks that the river L1 implementation results are no worse than sklearn L1."""
  
      X, y, true_coeffs = make_regression(
          n_samples=1000,
          n_features=20,
          n_informative=4,
          coef=True,
          random_state=273,
      )
      X = pd.DataFrame(X)
      y = pd.Series(y)
  
      ss = preprocessing.StandardScaler()
  
      rv = lm.LinearRegression(
          **{
              "optimizer": optim.SGD(1e-2),
              "loss": ScikitLearnSquaredLoss(),
              "l1": 1e-1,
          }
      )
  
      sk = sklm.SGDRegressor(
          **{
              "learning_rate": "constant",
              "eta0": 1e-2,
              "alpha": 1e-1,
              "penalty": "l1",
          }
      )
  
      for xi, yi in stream.iter_pandas(X, y):
          ss.learn_one(xi)
          xi_tr = ss.transform_one(xi)
          rv.learn_one(xi_tr, yi)
          sk.partial_fit([list(xi_tr.values())], [yi])
  
      rv_coeffs = np.array(list(rv.weights.values()))
      sk_coeffs = sk.coef_
  
      # check that the shrinkage to zero is no worse than in sklearn
      assert np.sum(rv_coeffs > 0) <= np.sum(sk_coeffs > 0)
  
      # check that the river coefficients shrink to the true ones with 10% relative tolerance
      assert np.isclose(
          rv_coeffs, true_coeffs, rtol=5e-02, atol=0.0
      ).all()
  
imports: from __future__ import annotations
  import copy
  import itertools
  import math
  import random
  import numpy
  import pandas
  import pytest
  from sklearn import linear_model
  from sklearn.datasets import make_classification, make_regression
  from sklearn.metrics import log_loss
  from river import datasets, optim, preprocessing, stream, utils
  from river import linear_model
label_desc: Use image node_id 10 for calling a global function with example usage: test_lin_reg_sklearn_l1_non_regression() without return types