class_docstr: The evaluation interface for semi-supervised learning and transfer learning for 
  graph-level tasks with pretraining and finetuning datasets. You can refer to `the benchmark 
  code <https://github.com/divelab/DIG/tree/dig/benchmarks/sslgraph>`_ for examples of usage.
  
  Args:
      dataset (torch_geometric.data.Dataset): The graph dataset for finetuning and evaluation.
      dataset_pretrain (torch_geometric.data.Dataset): The graph dataset for pretraining.
      label_rate (float, optional): Ratio of labels to use in finetuning dataset.
          (default: :obj:`1`)
      epoch_select (string, optional): :obj:`"test_max"` or :obj:`"val_max"`.
          (default: :obj:`"test_max"`)
      n_folds (int, optional): Number of folds for evaluation. (default: :obj:`10`)
      device (int, or torch.device, optional): Device for computation. (default: :obj:`None`)
      **kwargs (optional): Training and evaluation configs in :meth:`setup_train_config`.
      
  Examples
  --------
  >>> dataset, pretrain_dataset = get_dataset("NCI1", "semisupervised")
  >>> evaluator = GraphSemisupervised(dataset, pretrain_dataset, device=0)
  >>> evaluator.evaluate(model, encoder) # semi-supervised learning
  
  >>> dataset = MoleculeNet("./transfer_data", "HIV")
  >>> pretrain_dataset = ZINC("./transfer_data")
  >>> evaluator = GraphSemisupervised(dataset, pretrain_dataset, device=0)
  >>> evaluator.evaluate(model, encoder) # transfer learning for molecule classification
  
  Note
  ----
  When using :obj:`torch_geometric.data.Dataset` without our provided :obj:`get_dataset`
  function, you may need to manually add self-loops before input to evaluator if some view 
  function requires them, such as diffusion.
class_docstr_tok: ["The","evaluation","interface","for","semi-supervised","learning","and","transfer","learning","for","graph-level","tasks","with","pretraining","and","finetuning","datasets",".","You","can","refer","to","`","the","benchmark","code","<","https",":","\/\/github.com\/divelab\/DIG\/tree\/dig\/benchmarks\/sslgraph",">","`","_","for","examples","of","usage",".","Args",":","dataset","(","torch_geometric.data.Dataset",")",":","The","graph","dataset","for","finetuning","and","evaluation",".","dataset_pretrain","(","torch_geometric.data.Dataset",")",":","The","graph","dataset","for","pretraining",".","label_rate","(","float",",","optional",")",":","Ratio","of","labels","to","use","in","finetuning","dataset",".","(","default",":",":","obj",":","`","1","`",")","epoch_select","(","string",",","optional",")",":",":","obj",":","`","``","test_max","''","`","or",":","obj",":","`","``","val_max","''","`",".","(","default",":",":","obj",":","`","``","test_max","''","`",")","n_folds","(","int",",","optional",")",":","Number","of","folds","for","evaluation",".","(","default",":",":","obj",":","`","10","`",")","device","(","int",",","or","torch.device",",","optional",")",":","Device","for","computation",".","(","default",":",":","obj",":","`","None","`",")","*","*","kwargs","(","optional",")",":","Training","and","evaluation","configs","in",":","meth",":","`","setup_train_config","`",".","Examples","--","--","--","--",">",">",">","dataset",",","pretrain_dataset","=","get_dataset","(","``","NCI1","''",",","``","semisupervised","''",")",">",">",">","evaluator","=","GraphSemisupervised","(","dataset",",","pretrain_dataset",",","device=0",")",">",">",">","evaluator.evaluate","(","model",",","encoder",")","#","semi-supervised","learning",">",">",">","dataset","=","MoleculeNet","(","``",".\/transfer_data","''",",","``","HIV","''",")",">",">",">","pretrain_dataset","=","ZINC","(","``",".\/transfer_data","''",")",">",">",">","evaluator","=","GraphSemisupervised","(","dataset",",","pretrain_dataset",",","device=0",")",">",">",">","evaluator.evaluate","(","model",",","encoder",")","#","transfer","learning","for","molecule","classification","Note","--","--","When","using",":","obj",":","`","torch_geometric.data.Dataset","`","without","our","provided",":","obj",":","`","get_dataset","`","function",",","you","may","need","to","manually","add","self-loops","before","input","to","evaluator","if","some","view","function","requires","them",",","such","as","diffusion","."]
code: def get_optim(self, optim):
      if callable(optim):
          return optim
  
      optims = {"Adam": torch.optim.Adam}
  
      return optims[optim]
  
imports: import copy
  import torch
  import numpy
  import torch.nn
  from tqdm import trange
  from sklearn.model_selection import StratifiedKFold
  from torch_geometric.loader import DataLoader
  from sklearn.svm import SVC
  from sklearn import preprocessing
  from sklearn.metrics import accuracy_score
  from sklearn.model_selection import GridSearchCV
label_desc: Use image node_id 8 for calling the GraphSemisupervised obj's underlying member method code with example usage: obj.get_optim(optim) and returns: optims, optim