code: def test_incremental_basic(scheduler, dataframes):
      # Create observations that we know linear models can recover
      n, d = 100, 3
      rng = da.random.RandomState(42)
      X = rng.normal(size=(n, d), chunks=30)
      coef_star = rng.uniform(size=d, chunks=d)
      y = da.sign(X.dot(coef_star))
      y = (y + 1) / 2
      if dataframes:
          X = dd.from_array(X)
          y = dd.from_array(y)
  
      with scheduler() as (s, [_, _]):
          est1 = SGDClassifier(random_state=0, tol=1e-3, average=True)
          est2 = clone(est1)
  
          clf = Incremental(est1, random_state=0)
          result = clf.fit(X, y, classes=[0, 1])
          assert result is clf
  
          # est2 is a sklearn optimizer; this is just a benchmark
          if dataframes:
              X = X.to_dask_array(lengths=True)
              y = y.to_dask_array(lengths=True)
  
          for slice_ in da.core.slices_from_chunks(X.chunks):
              est2.partial_fit(
                  X[slice_].compute(),
                  y[slice_[0]].compute(),
                  classes=[0, 1],
              )
  
          assert isinstance(result.estimator_.coef_, np.ndarray)
          rel_error = np.linalg.norm(clf.coef_ - est2.coef_)
          rel_error /= np.linalg.norm(clf.coef_)
          assert rel_error < 0.9
  
          assert set(dir(clf.estimator_)) == set(dir(est2))
  
          #  Predict
          result = clf.predict(X)
          expected = est2.predict(X)
          assert isinstance(result, da.Array)
          if dataframes:
              # Compute is needed because chunk sizes of this array are unknown
              result = result.compute()
          rel_error = np.linalg.norm(result - expected)
          rel_error /= np.linalg.norm(expected)
          assert rel_error < 0.3
  
          # score
          result = clf.score(X, y)
          expected = est2.score(*dask.compute(X, y))
          assert abs(result - expected) < 0.1
  
          clf = Incremental(
              SGDClassifier(random_state=0, tol=1e-3, average=True)
          )
          clf.partial_fit(X, y, classes=[0, 1])
          assert set(dir(clf.estimator_)) == set(dir(est2))
  
imports: import dask
  import dask.array
  import dask.dataframe
  import numpy
  import pandas
  import pytest
  import sklearn.datasets
  import sklearn.model_selection
  from dask.array.utils import assert_eq
  from scipy.sparse import csr_matrix
  from sklearn.base import clone
  from sklearn.linear_model import SGDClassifier, SGDRegressor
  from sklearn.pipeline import make_pipeline
  import dask_ml.feature_extraction.text
  import dask_ml.metrics
  from dask_ml.metrics.scorer import check_scoring
  from dask_ml.wrappers import Incremental
label_desc: Use image node_id 3 for calling a global function with example usage: test_incremental_basic(scheduler, dataframes) without return types