code: def _build_ground_truth(
      bn: BayesianNetwork, data: pd.DataFrame, node: str
  ) -> pd.DataFrame:
      ground_truth = pd.get_dummies(data[node])
  
      # it's possible that not all states are present in the test set, so we need to add them to ground truth
      for dummy in bn.node_states[node]:
          if dummy not in ground_truth.columns:
              ground_truth[dummy] = [
                  0 for _ in range(len(ground_truth))
              ]
  
      # update ground truth column names to be correct, since we may have added missing columns
      return ground_truth[sorted(ground_truth.columns)]
  
imports: from typing import Dict, List, Tuple
  import pandas
  from sklearn import metrics
  from causalnex.network import BayesianNetwork
label_desc: Use image node_id 1 for calling a global function with example usage: _build_ground_truth(bn, data, node) and returns: ground_truth