code: def test_targetencoder_median():
      train = cudf.DataFrame(
          {
              "category": ["a", "a", "a", "a", "b", "b", "b", "b"],
              "label": [1, 22, 15, 17, 70, 9, 99, 56],
          }
      )
      encoder = TargetEncoder(stat="median")
      train_encoded = encoder.fit_transform(train.category, train.label)
      answer = np.array(
          [17.0, 15.0, 17.0, 15.0, 56.0, 70.0, 56.0, 70.0]
      )
      assert array_equal(train_encoded, answer)
  
      encoder = TargetEncoder(stat="median")
      encoder.fit(train.category, train.label)
      train_encoded = encoder.transform(train.category)
  
      assert array_equal(train_encoded, answer)
  
file_path: cuml/python/cuml/tests/test_target_encoder.py
imports: import pytest
  from cuml.testing.utils import array_equal
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.preprocessing.TargetEncoder import TargetEncoder
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 15 for calling a global function with example usage: test_targetencoder_median() without return types