code: def test_given_categorical_data_when_using_auto_fit_and_apply_encoder_then_returns_expected_feature_vector():
      X = np.array(["A", "B", "A", "D", "C", "C", "C", "A"])
      Y = np.array([1, 2, 3, 4, 2, 3, 4, 2])
  
      assert auto_apply_encoders(
          X, auto_fit_encoders(X, Y, catboost_threshold=3), Y
      ).reshape(-1) == approx(
          np.array(
              [
                  2.625,
                  2.625,
                  1.8125,
                  2.625,
                  2.625,
                  2.3125,
                  2.54166667,
                  2.20833333,
              ]
          )
      )
  
      assert auto_apply_encoders(
          X, auto_fit_encoders(X, Y, catboost_threshold=5), Y
      ) == approx(
          np.array(
              [
                  [1, 0, 0, 0],
                  [0, 1, 0, 0],
                  [1, 0, 0, 0],
                  [0, 0, 0, 1],
                  [0, 0, 1, 0],
                  [0, 0, 1, 0],
                  [0, 0, 1, 0],
                  [1, 0, 0, 0],
              ]
          )
      )
  
      X = np.array(
          [
              ["A", "A"],
              ["B", "B"],
              ["A", "A"],
              ["D", "D"],
              ["C", "C"],
              ["C", "C"],
              ["C", "C"],
              ["A", "A"],
          ]
      )
  
      assert auto_apply_encoders(
          X, auto_fit_encoders(X, Y, catboost_threshold=5), Y
      ) == approx(
          np.array(
              [
                  [
                      2.625,
                      2.625,
                      1.8125,
                      2.625,
                      2.625,
                      2.3125,
                      2.54166667,
                      2.20833333,
                  ],
                  [
                      2.625,
                      2.625,
                      1.8125,
                      2.625,
                      2.625,
                      2.3125,
                      2.54166667,
                      2.20833333,
                  ],
              ]
          ).T
      )
  
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 13 for calling a global function with example usage: test_given_categorical_data_when_using_auto_fit_and_apply_encoder_then_returns_expected_feature_vector() without return types