code: def get_avg_auc(
      df: pd.DataFrame,
      bn: BayesianNetwork,
      n_splits: int = 5,
      seed: int = 2021,
  ) -> float:
      """
      Estimate the average auc of all nodes in a Bayesian Network given a structure and a dataset using
      k-fold cross-validation. This function uses the bn.predict method in causalnex and cannot be used
      with latent variable models
  
      Args:
          df: a dataset in the pandas format
          bn: a bayesian network EM object
          n_splits: Number of folds in k-fold cv
          seed: random seed used in k-fold cv
  
      Returns:
          Average AUC
      """
      bn.fit_node_states(df)
      cv = KFold(n_splits=n_splits, shuffle=True, random_state=seed)
      total_auc = 0
  
      for fold, (train_idx, test_idx) in enumerate(cv.split(df)):
          t0 = time()
          cur_auc = 0
          train_df = df.loc[train_idx, :]
          test_df = df.loc[test_idx, :]
          bn.fit_cpds(
              train_df, method="BayesianEstimator", bayes_prior="K2"
          )
  
          for var in bn.nodes:
              _, auc = roc_auc(bn, test_df, var)
              cur_auc += auc
  
          print(f"Processing fold {fold} takes {time() - t0} seconds")
          total_auc += cur_auc / len(bn.nodes)
  
      return total_auc / n_splits
  
imports: import json
  import multiprocessing
  import os
  import warnings
  from collections import defaultdict
  from time import time
  from typing import List, Tuple
  import dataframe_image
  import networkx
  import numpy
  import pandas
  from IPython.core.display import display
  from IPython.display import Image
  from sklearn import metrics
  from sklearn.model_selection import KFold
  from causalnex.evaluation import roc_auc
  from causalnex.inference import InferenceEngine
  from causalnex.network import BayesianNetwork
  from causalnex.plots import plot_structure
  from causalnex.structure import StructureModel
label_desc: Use image node_id 7 for calling a global function with example usage: get_avg_auc(df, bn, n_splits, seed) and returns: unknown