code: def test_local_classifier(create_cluster):
      y_data = (y * 10).astype(mt.int32)
      classifier = LGBMClassifier(n_estimators=2)
      classifier.fit(X, y_data, eval_set=[(X, y_data)])
      prediction = classifier.predict(X)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X)
  
      assert isinstance(prediction, mt.Tensor)
  
      # test sparse tensor
      X_sparse_data = X_sparse
      classifier = LGBMClassifier(n_estimators=2)
      classifier.fit(
          X_sparse_data, y_data, eval_set=[(X_sparse_data, y_data)]
      )
      prediction = classifier.predict(X_sparse_data)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X)
  
      assert isinstance(prediction, mt.Tensor)
  
      prob = classifier.predict_proba(X)
      assert prob.shape == X.shape
  
      prediction_empty = classifier.predict(
          mt.array([]).reshape((0, X.shape[1]))
      )
      assert prediction_empty.shape == (0,)
  
      # test dataframe
      X_df_data = X_df
      classifier = LGBMClassifier(n_estimators=2)
      classifier.fit(X_df_data, y_data)
      prediction = classifier.predict(X_df_data)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X)
  
      prob = classifier.predict_proba(X_df)
  
      assert prob.ndim == 2
      assert prob.shape == (len(X), 10)
  
      # test weight
      weights = [
          mt.random.rand(X.shape[0]),
          md.Series(mt.random.rand(X.shape[0])),
      ]
      y_df = md.DataFrame(y_data)
      for weight in weights:
          classifier = LGBMClassifier(n_estimators=2)
          classifier.fit(X, y_df, sample_weight=weight)
          prediction = classifier.predict(X)
  
          assert prediction.ndim == 1
          assert prediction.shape[0] == len(X)
  
      # should raise error if weight.ndim > 1
      with pytest.raises(ValueError):
          LGBMClassifier(n_estimators=2).fit(
              X, y_df, sample_weight=mt.random.rand(1, 1)
          )
  
      # test binary classifier
      new_y = (y_data > 0.5).astype(mt.int32)
      classifier = LGBMClassifier(n_estimators=2)
      classifier.fit(X, new_y)
  
      prediction = classifier.predict(X)
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X)
  
      prediction = classifier.predict_proba(X)
      assert prediction.ndim == 2
      assert prediction.shape[0] == len(X)
  
      # test with existing model
      X_np = X.execute().fetch()
      new_y_np = new_y.execute().fetch()
      raw_classifier = lightgbm.LGBMClassifier(n_estimators=2)
      raw_classifier.fit(X_np, new_y_np)
  
      classifier = LGBMClassifier(raw_classifier)
      label_result = classifier.predict(X_df)
      assert label_result.ndim == 1
      assert label_result.shape[0] == len(X)
  
      proba_result = classifier.predict_proba(X_df)
      assert proba_result.ndim == 2
      assert proba_result.shape[0] == len(X)
  
file_path: mars/mars/learn/contrib/lightgbm/tests/test_classifier.py
imports: import os
  import tempfile
  import numpy
  import pandas
  import pytest
  from .....None import tensor
  from .....None import dataframe
  from .....deploy.oscar.local import new_cluster
label_desc: Use image node_id 1 for calling a global function with example usage: test_local_classifier(create_cluster) without return types