code: def build_bayesian_network(self, g, df):
      for node in nx.topological_sort(g):
          if g.nodes()[node]["parent_names"]:
              mu = g.nodes()[node]["parameters"][0]  # intercept
              mu += pm.math.dot(
                  df[g.nodes()[node]["parent_names"]],
                  g.nodes()[node]["parameters"][1:],
              )
              if g.nodes()[node]["variable_type"] == "c":
                  sd = g.nodes()[node]["sd"]
                  g.nodes()[node]["variable"] = pm.Normal(
                      "{}".format(node), mu=mu, sd=sd, observed=df[node]
                  )
              elif g.nodes()[node]["variable_type"] == "b":
                  g.nodes()[node]["variable"] = pm.Bernoulli(
                      "{}".format(node), logit_p=mu, observed=df[node]
                  )
              else:
                  raise Exception(
                      "Unrecognized variable type: {}".format(
                          g.nodes()[node]["variable_type"]
                      )
                  )
      return g
  
file_path: dowhy/dowhy/do_samplers/mcmc_sampler.py
imports: from typing import List
  import networkx
  import numpy
  import pymc3
  from dowhy import EstimandType
  from dowhy.do_sampler import DoSampler
label_desc: Use image node_id 5 for calling the McmcSampler obj's underlying member method code with example usage: obj.build_bayesian_network(g, df) and returns: g