code: def compute_noise_from_data(
      causal_model: InvertibleStructuralCausalModel,
      observed_data: pd.DataFrame,
  ) -> pd.DataFrame:
      validate_causal_dag(causal_model.graph)
  
      sorted_noise = list(nx.topological_sort(causal_model.graph))
      noise = pd.DataFrame(
          np.empty((observed_data.shape[0], len(sorted_noise))),
          columns=sorted_noise,
      )
  
      for node in sorted_noise:
          if is_root_node(causal_model.graph, node):
              noise[node] = observed_data[node].to_numpy().squeeze()
          else:
              noise[node] = (
                  causal_model.causal_mechanism(node)
                  .estimate_noise(
                      observed_data[node].to_numpy(),
                      _parent_samples_of(
                          node, causal_model, observed_data
                      ),
                  )
                  .squeeze()
              )
  
      return noise
  
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 2 for calling a global function with example usage: compute_noise_from_data(causal_model, observed_data) and returns: noise