code: def test_targetencoder_var():
      train = cudf.DataFrame(
          {"category": ["a", "b", "b", "b"], "label": [1, 0, 1, 1]}
      )
      encoder = TargetEncoder(stat="var")
      train_encoded = encoder.fit_transform(train.category, train.label)
      answer = np.array([0.25, 0.0, 0.5, 0.5])
      assert array_equal(train_encoded, answer)
  
      encoder = TargetEncoder(stat="var")
      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 12 for calling a global function with example usage: test_targetencoder_var() without return types