code: def test_local_classifier(setup):
      y = (y_raw * 10).astype(mt.int32)
      classifier = XGBClassifier(verbosity=1, n_estimators=2)
      classifier.fit(X_raw, y, eval_set=[(X_raw, y)])
      prediction = classifier.predict(X_raw)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X_raw)
  
      history = classifier.evals_result()
  
      assert isinstance(prediction, mt.Tensor)
      assert isinstance(history, dict)
  
      assert list(history)[0] == "validation_0"
      # default metrics may differ, see https://github.com/dmlc/xgboost/pull/6183
      eval_metric = list(history["validation_0"])[0]
      assert eval_metric in ("merror", "mlogloss")
      assert len(history["validation_0"]) == 1
      assert len(history["validation_0"][eval_metric]) == 2
  
      prob = classifier.predict_proba(X_raw)
      assert prob.shape == X_raw.shape
  
      # test dataframe
      X_df = X_df_raw
      classifier = XGBClassifier(verbosity=1, n_estimators=2)
      classifier.fit(X_df, y)
      prediction = classifier.predict(X_df)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X_raw)
  
      # test weight
      weights = [
          mt.random.rand(X_raw.shape[0]),
          md.Series(mt.random.rand(X_raw.shape[0])),
          md.DataFrame(mt.random.rand(X_raw.shape[0])),
      ]
      y_df = md.DataFrame(y)
      for weight in weights:
          classifier = XGBClassifier(verbosity=1, n_estimators=2)
          classifier.fit(X_raw, y_df, sample_weight=weight)
          prediction = classifier.predict(X_raw)
  
          assert prediction.ndim == 1
          assert prediction.shape[0] == len(X_raw)
  
      # should raise error if weight.ndim > 1
      with pytest.raises(ValueError):
          XGBClassifier(verbosity=1, n_estimators=2).fit(
              X_raw, y_df, sample_weight=mt.random.rand(1, 1)
          )
  
      # test binary classifier
      new_y = (y > 0.5).astype(mt.int32)
      classifier = XGBClassifier(verbosity=1, n_estimators=2)
      classifier.fit(X_raw, new_y)
      prediction = classifier.predict(X_raw)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X_raw)
  
      # test predict data with unknown shape
      X2 = X_raw[X_raw[:, 0] > 0.1].astype(mt.int32)
      prediction = classifier.predict(X2)
  
      assert prediction.ndim == 1
  
      # test train with unknown shape
      cond = X_raw[:, 0] > 0
      X3 = X_raw[cond]
      y3 = y[cond]
      classifier = XGBClassifier(verbosity=1, n_estimators=2)
      classifier.fit(X3, y3)
      prediction = classifier.predict(X_raw)
  
      assert prediction.ndim == 1
      assert prediction.shape[0] == len(X_raw)
  
      classifier = XGBClassifier(verbosity=1, n_estimators=2)
      with pytest.raises(TypeError):
          classifier.fit(X_raw, y, wrong_param=1)
      classifier.fit(X_raw, y)
      with pytest.raises(TypeError):
          classifier.predict(X_raw, wrong_param=1)
  
file_path: mars/mars/learn/contrib/xgboost/tests/test_classifier.py
imports: import os
  import tempfile
  import numpy
  import pandas
  import pytest
  from .....None import tensor
  from .....None import dataframe
  from ..classifier import XGBClassifier
label_desc: Use image node_id 1 for calling a global function with example usage: test_local_classifier(setup) without return types