code: def test_given_continuous_and_categorical_variables_when_get_noise_dependent_function_then_represents_correct_function():
      causal_model = StructuralCausalModel(
          nx.DiGraph([("X0", "X2"), ("X1", "X2"), ("X2", "X3")])
      )
  
      X0 = np.random.normal(0, 1, 1000)
      X1 = np.random.choice(2, 1000).astype(str)
  
      X2 = []
      for x0, x1 in zip(X0, X1):
          if x1 == "0":
              x = np.random.normal(0, 1)
          else:
              x = np.random.normal(1, 1)
  
          if x < 0.5:
              X2.append(x0 + 2 > 0)
          else:
              X2.append(x0 - 2 > 0)
  
      X2 = np.array(X2).astype(str)
  
      X3 = []
      for x2 in X2:
          if x2 == "True":
              x = np.random.normal(0, 1)
          else:
              x = np.random.normal(1, 1)
  
          if x < 0.5:
              X3.append("False")
          else:
              X3.append("True")
  
      X3 = np.array(X3).astype(str)
      data = pd.DataFrame({"X0": X0, "X1": X1, "X2": X2, "X3": X3})
  
      assign_causal_mechanisms(causal_model, data)
  
      fit(causal_model, data)
      fn, parent_order = get_noise_dependent_function(
          causal_model, "X3"
      )
  
      assert sorted(parent_order[:2]) == ["X0", "X1"]
      assert parent_order[2:] == ["X2", "X3"]
      assert np.all(
          fn(
              pd.DataFrame(
                  {
                      "X0": [0, 0, 0, 0],
                      "X1": ["0", "0", "0", "0"],
                      "X2": [0, 0, 0, 1],
                      "X3": [1, 0, 0.6, 0.6],
                  }
              )[parent_order].to_numpy()
          )
          == np.array(["True", "False", "True", "False"])
      )
  
      fn, parent_order = get_noise_dependent_function(
          causal_model,
          "X3",
          approx_prediction_model=create_logistic_regression_classifier(),
      )
      assert np.all(
          fn(
              pd.DataFrame(
                  {
                      "X0": [0, 0, 0, 0],
                      "X1": ["0", "0", "0", "0"],
                      "X2": [0, 0, 0, 1],
                      "X3": [1, 0, 0.6, 0.6],
                  }
              )[parent_order].to_numpy()
          ).reshape(-1)
          == np.array(["True", "False", "True", "False"])
      )
  
file_path: dowhy/tests/gcm/test_noise.py
imports: import networkx
  import numpy
  import pandas
  from _pytest.python_api import approx
  from flaky import flaky
  from dowhy.gcm import AdditiveNoiseModel, EmpiricalDistribution, InvertibleStructuralCausalModel, StructuralCausalModel, fit
  from dowhy.gcm._noise import compute_data_from_noise, compute_noise_from_data, get_noise_dependent_function
  from dowhy.gcm.auto import assign_causal_mechanisms
  from dowhy.gcm.causal_models import PARENTS_DURING_FIT
  from dowhy.gcm.ml import create_linear_regressor, create_linear_regressor_with_given_parameters, create_logistic_regression_classifier
  from dowhy.graph import DirectedGraph, get_ordered_predecessors
label_desc: Use image node_id 4 for calling a global function with example usage: test_given_continuous_and_categorical_variables_when_get_noise_dependent_function_then_represents_correct_function() without return types