code: def test_min_max_scaler_partial_fit(setup, chunk_size):
      # Test if partial_fit run over many batches of size 1 and 50
      # gives the same results as fit
      X = X_2d
      n = X.shape[0]
  
      # Test mean at the end of the process
      scaler_batch = MinMaxScaler().fit(X)
  
      scaler_incr = MinMaxScaler()
      for batch in gen_batches(n_samples, chunk_size):
          scaler_incr = scaler_incr.partial_fit(X[batch])
  
      assert_array_almost_equal(
          scaler_batch.data_min_, scaler_incr.data_min_
      )
      assert_array_almost_equal(
          scaler_batch.data_max_, scaler_incr.data_max_
      )
      assert scaler_batch.n_samples_seen_ == scaler_incr.n_samples_seen_
      assert_array_almost_equal(
          scaler_batch.data_range_, scaler_incr.data_range_
      )
      assert_array_almost_equal(scaler_batch.scale_, scaler_incr.scale_)
      assert_array_almost_equal(scaler_batch.min_, scaler_incr.min_)
  
      # Test std after 1 step
      batch0 = slice(0, chunk_size)
      scaler_batch = MinMaxScaler().fit(X[batch0])
      scaler_incr = MinMaxScaler().partial_fit(X[batch0])
  
      assert_array_almost_equal(
          scaler_batch.data_min_, scaler_incr.data_min_
      )
      assert_array_almost_equal(
          scaler_batch.data_max_, scaler_incr.data_max_
      )
      assert scaler_batch.n_samples_seen_ == scaler_incr.n_samples_seen_
      assert_array_almost_equal(
          scaler_batch.data_range_, scaler_incr.data_range_
      )
      assert_array_almost_equal(scaler_batch.scale_, scaler_incr.scale_)
      assert_array_almost_equal(scaler_batch.min_, scaler_incr.min_)
  
      # Test std until the end of partial fits, and
      _ = MinMaxScaler().fit(X)
      scaler_incr = MinMaxScaler()  # Clean estimator
      for i, batch in enumerate(gen_batches(n_samples, chunk_size)):
          scaler_incr = scaler_incr.partial_fit(X[batch])
          assert_correct_incr(
              i,
              batch_start=batch.start,
              batch_stop=batch.stop,
              n=n,
              chunk_size=chunk_size,
              n_samples_seen=scaler_incr.n_samples_seen_,
          )
  
file_path: mars/mars/learn/preprocessing/tests/test_data.py
imports: import pytest
  from sklearn.datasets import load_iris
  from sklearn.utils import gen_batches
  from sklearn.utils._testing import assert_array_almost_equal, assert_allclose
  from ....None import tensor
  from ..None import MinMaxScaler, minmax_scale
label_desc: Use image node_id 3 for calling a global function with example usage: test_min_max_scaler_partial_fit(setup, chunk_size) without return types