code: def _get_approx_noise_dependent_function(
      causal_model: StructuralCausalModel,
      target_node: Any,
      approx_prediction_model: PredictionModel,
      num_training_samples: int,
  ) -> Tuple[Callable[[np.ndarray], np.ndarray], List[Any]]:
      nodes_order = list(nx.topological_sort(causal_model.graph))
  
      node_samples, noise_samples = noise_samples_of_ancestors(
          causal_model, target_node, num_training_samples
      )
  
      approx_prediction_model.fit(
          shape_into_2d(noise_samples[nodes_order].to_numpy()),
          shape_into_2d(node_samples[target_node].to_numpy()),
      )
  
      return approx_prediction_model.predict, nodes_order
  
file_path: dowhy/dowhy/gcm/_noise.py
imports: from typing import Any, Callable, List, Optional, Tuple
  import networkx
  import numpy
  import pandas
  from dowhy.gcm.causal_models import InvertibleStructuralCausalModel, ProbabilisticCausalModel, StructuralCausalModel, validate_causal_dag
  from dowhy.gcm.ml.prediction_model import PredictionModel
  from dowhy.gcm.util.general import shape_into_2d
  from dowhy.graph import get_ordered_predecessors, is_root_node, node_connected_subgraph_view
label_desc: Use image node_id 5 for calling a global function with example usage: _get_approx_noise_dependent_function(causal_model, target_node, approx_prediction_model, num_training_samples) and returns: approx_prediction_model,  nodes_order