code: def grid_search(config: dict):
      args = parse_args()
      results = {}
  
      for d in config["dataset"]:
          args.dataset = d
          best_acc, err_bd = 0.0, 0.0
          best_args = vars(args)
          for arch in config["arch"]:
              args.architecture = arch
              for hidden in config["hidden"]:
                  args.hid_dim = hidden
                  for pool_ratio in config["pool_ratio"]:
                      args.pool_ratio = pool_ratio
                      for lr in config["lr"]:
                          args.lr = lr
                          for weight_decay in config["weight_decay"]:
                              args.weight_decay = weight_decay
                              acc, bd = run_experiments(args)
                              if acc > best_acc:
                                  best_acc = acc
                                  err_bd = bd
                                  best_args = deepcopy(vars(args))
          args.output_path = "./output"
          if not os.path.exists(args.output_path):
              os.makedirs(args.output_path)
          args.output_path = "./output/{}.log".format(d)
          result = {
              "params": best_args,
              "result": "{:.4f}({:.4f})".format(best_acc, err_bd),
          }
          with open(args.output_path, "w") as f:
              json.dump(result, f, sort_keys=True, indent=4)
  
file_path: dgl/examples/pytorch/sagpool/grid_search.py
imports: import json
  import os
  from copy import deepcopy
  from main import main, parse_args
  from utils import get_stats
label_desc: Use image node_id 3 for calling a global function with example usage: grid_search(config) without return types