code: def test_given_categorical_input_and_target_data_when_fit_catboost_encoders_and_apply_catboost_encoding_then_returns_expected_feature_vector():
      X = np.array(["A", "B", "A", "C", "A"])
      Y = np.array(["C1", "C1", "C1", "C2", "C1"])
  
      assert apply_catboost_encoding(
          X, fit_catboost_encoders(X, Y), Y
      ).reshape(-1) == approx(
          np.array(
              [
                  0.2,  # Data mean when converting labels to 0...n
                  0.2,  # Data mean when converting labels to 0...n
                  0.1,  # (0 + 0 (label "C1") + 0.2 (data mean)) / 2
                  0.2,  # Data mean when converting labels to 0...n
                  0.2
                  / 3,  # (0 + 0 + 0 (label "C1") + 0.2 (data mean)) / 3
              ]
          )
      )
  
      Y = np.array(["C1", "C1", "C2", "C2", "C1"])
  
      assert apply_catboost_encoding(
          X, fit_catboost_encoders(X, Y), Y
      ).reshape(-1) == approx(
          np.array(
              [
                  0.4,  # Data mean when converting labels to 0...n
                  0.4,  # Data mean when converting labels to 0...n
                  0.2,  # (0 (label "C1") + 1 (label "C2") + 0.4 (data mean)) / 2
                  0.4,  # Data mean when converting labels to 0...n
                  1.4
                  / 3,  # (0 (label "C1") + 1 (label "C2") + 0 + 0.4 (data mean)) / 3
              ]
          )
      )
  
imports: import random
  import networkx
  import numpy
  import pandas
  import pytest
  from _pytest.python_api import approx
  from dowhy import gcm
  from dowhy.gcm.util.general import apply_catboost_encoding, apply_one_hot_encoding, auto_apply_encoders, auto_fit_encoders, fit_catboost_encoders, fit_one_hot_encoders, has_categorical, is_categorical, is_discrete, set_random_seed, setdiff2d, shape_into_2d
label_desc: Use image node_id 12 for calling a global function with example usage: test_given_categorical_input_and_target_data_when_fit_catboost_encoders_and_apply_catboost_encoding_then_returns_expected_feature_vector() without return types