code: def logistic_classify(x, y, device="cpu"):
      nb_classes = np.unique(y).shape[0]
      xent = nn.CrossEntropyLoss()
      hid_units = x.shape[1]
  
      accs = []
      kf = StratifiedKFold(n_splits=10, shuffle=True, random_state=None)
      for train_index, test_index in kf.split(x, y):
          train_embs, test_embs = x[train_index], x[test_index]
          train_lbls, test_lbls = y[train_index], y[test_index]
  
          train_embs, train_lbls = torch.from_numpy(train_embs).to(
              device
          ), torch.from_numpy(train_lbls).to(device)
          test_embs, test_lbls = torch.from_numpy(test_embs).to(
              device
          ), torch.from_numpy(test_lbls).to(device)
  
          log = LogReg(hid_units, nb_classes)
          log = log.to(device)
  
          opt = torch.optim.Adam(
              log.parameters(), lr=0.01, weight_decay=0.0
          )
  
          for it in range(100):
              log.train()
              opt.zero_grad()
  
              logits = log(train_embs)
              loss = xent(logits, train_lbls)
  
              loss.backward()
              opt.step()
  
          logits = log(test_embs)
          preds = torch.argmax(logits, dim=1)
          acc = (
              torch.sum(preds == test_lbls).float() / test_lbls.shape[0]
          )
          accs.append(acc.item())
      return np.mean(accs)
  
file_path: dgl/examples/pytorch/infograph/evaluate_embedding.py
imports: import numpy
  import torch
  import torch.nn
  from sklearn import preprocessing
  from sklearn.metrics import accuracy_score
  from sklearn.model_selection import GridSearchCV, StratifiedKFold
  from sklearn.svm import SVC
label_desc: Use image node_id 1 for calling a global function with example usage: logistic_classify(x, y, device) and returns: np