code: def test_bagging_sample_reindex(
      setup, use_dataframe, max_samples, max_features, column_split
  ):
      rs = np.random.RandomState(0)
  
      raw_insts = rs.randint(100, size=(100, 50))
      raw_data = rs.randint(100, size=(200, 50))
      if not use_dataframe:
          t_insts = mt.tensor(raw_insts, chunk_size=column_split)
          t_data = mt.tensor(raw_data, chunk_size=column_split)
      else:
          raw_insts = pd.DataFrame(raw_insts)
          raw_data = pd.DataFrame(raw_data)
          t_insts = md.DataFrame(raw_insts, chunk_size=column_split)
          t_data = md.DataFrame(raw_data, chunk_size=column_split)
  
      sample_op = BaggingSample(
          n_estimators=10,
          max_samples=max_samples,
          max_features=max_features,
          random_state=rs,
      )
      result_tuple = execute(*sample_op(t_insts))
      (
          _t_sampled,
          _label,
          _weights,
          t_feature_indices,
      ) = _extract_bagging_io(result_tuple, sample_op, output=True)
  
      reindex_op = BaggingSampleReindex(n_estimators=10)
      reindexed = execute(
          reindex_op(t_data, t_feature_indices),
          extra_config={"check_dtypes": False},
      )
  
      for tiled, _chunk, chunk_data in _get_tileable_chunk_data(
          setup, reindexed
      ):
          if t_feature_indices is None:
              assert len(tiled.chunks) == np.ceil(
                  raw_data.shape[0] / column_split
              )
              assert chunk_data.shape[1] == 50
          else:
              row_chunks = np.ceil(raw_insts.shape[0] / column_split)
              assert len(tiled.chunks) == row_chunks * np.ceil(
                  raw_data.shape[0] / column_split
              )
              assert isinstance(chunk_data, tuple)
              for chunk_data_piece in chunk_data:
                  assert chunk_data_piece.shape[1] == 25
  
file_path: mars/mars/learn/ensemble/tests/test_bagging.py
imports: import asyncio
  import os
  import numpy
  import pandas
  import pytest
  from sklearn.datasets import make_classification, make_regression
  from sklearn.linear_model import LinearRegression, LogisticRegression
  from sklearn.svm import SVC
  from ....None import tensor, dataframe, execute
  from ....conftest import MARS_CI_BACKEND
  from ....core import enter_mode
  from ....services.task.execution.api import Fetcher
  from .._bagging import _extract_bagging_io, BaggingSample, BaggingSampleReindex, BaggingClassifier, BaggingRegressor
label_desc: Use image node_id 3 for calling a global function with example usage: test_bagging_sample_reindex(setup, use_dataframe, max_samples, max_features, column_split) without return types