code: def test_bagging_regressor(
      setup, use_dataframe, max_samples, max_features, with_weights
  ):
      rs = np.random.RandomState(0)
  
      raw_x, raw_y = make_regression(
          n_samples=100,
          n_features=4,
          n_informative=2,
          random_state=rs,
          shuffle=False,
      )
  
      if not use_dataframe:
          t_x = mt.tensor(raw_x, chunk_size=20)
      else:
          raw_x = pd.DataFrame(raw_x)
          t_x = md.DataFrame(raw_x, chunk_size=20)
  
      raw_weights = rs.random(100)
      t_y = mt.tensor(raw_y, chunk_size=20)
      t_weights = (
          mt.tensor(raw_weights, chunk_size=20)
          if with_weights
          else None
      )
  
      clf = BaggingRegressor(
          base_estimator=LinearRegression(),
          n_estimators=10,
          max_samples=max_samples,
          max_features=max_features,
          random_state=rs,
          warm_start=True,
      )
      clf.fit(t_x, t_y, sample_weight=t_weights)
  
      predict_y = clf.predict(t_x)
      predict_y_array = predict_y.fetch()
      assert predict_y_array.shape == raw_y.shape
  
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 5 for calling a global function with example usage: test_bagging_regressor(setup, use_dataframe, max_samples, max_features, with_weights) without return types