code: def test_local_regressor(setup):
      regressor = LGBMRegressor(n_estimators=2)
      regressor.fit(X, y)
      prediction = regressor.predict(X)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X)
  
      assert isinstance(prediction, mt.Tensor)
      result = prediction.fetch()
      assert prediction.dtype == result.dtype
  
      # test weight
      weight = mt.random.rand(X.shape[0])
      regressor = LGBMRegressor(verbosity=1, n_estimators=2)
      regressor.fit(X, y, sample_weight=weight)
      prediction = regressor.predict(X)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X)
      result = prediction.fetch()
      assert prediction.dtype == result.dtype
  
      # test numpy tensor
      try:
          from sklearn.datasets import make_classification
  
          X_array, y_array = make_classification()
          regressor = LGBMRegressor(n_estimators=2)
          regressor.fit(X_array, y_array)
          prediction = regressor.predict(X_array)
  
          assert prediction.ndim == 1
          assert prediction.shape[0] == len(X_array)
  
          X_df = pd.DataFrame(X_array)
          y_df = pd.Series(y_array)
          regressor = LGBMRegressor(n_estimators=2)
          regressor.fit(X_df, y_df)
          prediction = regressor.predict(X_df)
  
          assert prediction.ndim == 1
          assert prediction.shape[0] == len(X_df)
      except ImportError:
          pass
  
      # test existing model
      X_np = X.execute().fetch()
      y_np = y.execute().fetch()
      raw_regressor = lightgbm.LGBMRegressor(
          verbosity=1, n_estimators=2
      )
      raw_regressor.fit(X_np, y_np)
      prediction = LGBMRegressor(raw_regressor).predict(X)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X)
  
imports: import pandas
  import pytest
  from .....None import tensor
label_desc: Use image node_id 1 for calling a global function with example usage: test_local_regressor(setup) without return types