class_docstr: Runs the training of a graph classification model using the augmented
  data generated by the already trained generator. Check
  :obj:`examples.auggraph.GraphAug.run_aug_cls` for examples on how to run
  this augmented classifier model.
  
  Args:
      data_root_path (string): Directory where datasets should be saved.
      dataset_name (:class:`dig.auggraph.method.GraphAug.constants.enums.DatasetName`):
          Name of the graph dataset.
      conf (dict): Hyperparameters for the model. Check
          :obj:`examples.auggraph.GraphAug.conf.aug_cls_conf` for examples on
          how to define the conf dictionary for the augmented classifier
          model.
class_docstr_tok: ["Runs","the","training","of","a","graph","classification","model","using","the","augmented","data","generated","by","the","already","trained","generator",".","Check",":","obj",":","`","examples.auggraph.GraphAug.run_aug_cls","`","for","examples","on","how","to","run","this","augmented","classifier","model",".","Args",":","data_root_path","(","string",")",":","Directory","where","datasets","should","be","saved",".","dataset_name","(",":","class",":","`","dig.auggraph.method.GraphAug.constants.enums.DatasetName","`",")",":","Name","of","the","graph","dataset",".","conf","(","dict",")",":","Hyperparameters","for","the","model",".","Check",":","obj",":","`","examples.auggraph.GraphAug.conf.aug_cls_conf","`","for","examples","on","how","to","define","the","conf","dictionary","for","the","augmented","classifier","model","."]
docstr: This method is used to run the training for the classification model
  on the augmented graph dataset and then validate the epoch parameters.
  
  Args:
      out_root_path (string): Directory where the results of this
          augmented classifier model will be saved.
      log_file (string): File where training and validation logs are
          written.
docstr_tok: ["This","method","is","used","to","run","the","training","for","the","classification","model","on","the","augmented","graph","dataset","and","then","validate","the","epoch","parameters",".","Args",":","out_root_path","(","string",")",":","Directory","where","the","results","of","this","augmented","classifier","model","will","be","saved",".","log_file","(","string",")",":","File","where","training","and","validation","logs","are","written","."]
code: def train_test(self, out_root_path, log_file="record.txt"):
      r"""
      This method is used to run the training for the classification model
      on the augmented graph dataset and then validate the epoch parameters.
  
      Args:
          out_root_path (string): Directory where the results of this
              augmented classifier model will be saved.
          log_file (string): File where training and validation logs are
              written.
      """
      val_accs, test_accs = [], []
      kf = KFold(n_splits=10, shuffle=True)
      self.dataset.shuffle()
      self.model = self.model.to(self.device)
  
      out_path = os.path.join(out_root_path, self.dataset_name.value)
      if not os.path.isdir(out_path):
          os.makedirs(out_path)
  
      f = open(os.path.join(out_path, log_file), "a")
      f.write(
          "10-CV results for dataset {} with model {}, num layers {}, hidden {}\n".format(
              self.dataset_name,
              self.conf[MODEL_NAME].value,
              self.conf[NUM_LAYERS],
              self.conf[HIDDEN_UNITS],
          )
      )
      f.write("Use the learnable augmentation with params below\n")
      for aug_type in self.conf[GENERATOR_PARAMS][AUG_TYPE_PARAMS]:
          f.write(
              "{}: {}\n".format(
                  aug_type,
                  self.conf[GENERATOR_PARAMS][AUG_TYPE_PARAMS][
                      aug_type
                  ],
              )
          )
      f.close()
  
      for i, (train_idx, test_idx) in enumerate(
          kf.split(list(range(len(self.dataset))))
      ):
          train_idx, val_idx = train_test_split(
              train_idx, test_size=0.1
          )
          train_set, val_set, test_set = (
              Subset(
                  self.dataset[train_idx.tolist()],
                  transform=self.train_data_trans,
              ),
              Subset(
                  self.dataset[val_idx.tolist()],
                  transform=self.data_trans,
              ),
              Subset(
                  self.dataset[test_idx.tolist()],
                  transform=self.data_trans,
              ),
          )
          train_loader = DataLoader(
              train_set,
              batch_size=self.conf[BATCH_SIZE],
              shuffle=True,
              num_workers=16,
          )
          val_loader = DataLoader(
              val_set, batch_size=self.conf[BATCH_SIZE], shuffle=True
          )
          test_loader = DataLoader(
              test_set, batch_size=self.conf[BATCH_SIZE], shuffle=True
          )
  
          self.model.reset_parameters()
          optimizer = torch.optim.Adam(
              self.model.parameters(), lr=self.conf[INITIAL_LR]
          )
          scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(
              optimizer,
              mode="min",
              factor=self.conf[FACTOR],
              patience=self.conf[PATIENCE],
              min_lr=self.conf[MIN_LR],
          )
  
          best_val_acc, best_test_acc = 0.0, 0.0
          for epoch in range(self.conf[MAX_NUM_EPOCHS]):
              lr = scheduler.optimizer.param_groups[0]["lr"]
              self._train_epoch(train_loader, optimizer)
  
              val_acc = self.test(val_loader)
              print(
                  "Epoch {}, validation accuracy {}".format(
                      epoch, val_acc
                  )
              )
  
              test_acc = self.test(test_loader)
  
              scheduler.step(val_acc)
  
              if val_acc > best_val_acc:
                  best_val_acc = val_acc
  
              if test_acc > best_test_acc:
                  best_test_acc = test_acc
  
              if lr < self.conf[MIN_LR]:
                  break
  
          val_accs.append(best_val_acc)
          test_accs.append(best_test_acc)
  
          f = open(os.path.join(out_path, log_file), "a")
          f.write(
              "Split {}, validation accuracy {}, test accuracy {}\n".format(
                  i, best_val_acc, best_test_acc
              )
          )
          f.close()
  
      f = open(os.path.join(out_path, log_file), "a")
      f.write(
          "Validation accuracy mean {}, std {}\n".format(
              np.mean(val_accs), np.std(val_accs)
          )
      )
      f.write(
          "Test accuracy mean {}, std {}\n".format(
              np.mean(test_accs), np.std(test_accs)
          )
      )
      f.close()
  
imports: import os
  import torch
  import torch.nn.functional
  import numpy
  from torch_geometric.loader import DataLoader
  from torch_geometric.datasets import TUDataset
  from sklearn.model_selection import KFold, train_test_split
  from dig.auggraph.method.GraphAug.model import GIN, GCN
  from dig.auggraph.dataset.aug_dataset import DegreeTrans, Subset, AUG_trans
  from dig.auggraph.method.GraphAug.aug import Augmenter
  from dig.auggraph.method.GraphAug.constants import *
label_desc: Use image node_id 7 for calling the RunnerAugCls obj's underlying member method code with example usage: obj.train_test(out_root_path, log_file) without return types