code: def label_classification(
      embeddings, y, train_mask, test_mask, split="random", ratio=0.1
  ):
      X = embeddings.detach().cpu().numpy()
      Y = y.detach().cpu().numpy()
      Y = Y.reshape(-1, 1)
      onehot_encoder = OneHotEncoder(categories="auto").fit(Y)
      Y = onehot_encoder.transform(Y).toarray().astype(np.bool_)
  
      X = normalize(X, norm="l2")
  
      if split == "random":
          X_train, X_test, y_train, y_test = train_test_split(
              X, Y, test_size=1 - ratio
          )
      elif split == "public":
          X_train = X[train_mask]
          X_test = X[test_mask]
          y_train = Y[train_mask]
          y_test = Y[test_mask]
  
      logreg = LogisticRegression(solver="liblinear")
      c = 2.0 ** np.arange(-10, 10)
  
      clf = GridSearchCV(
          estimator=OneVsRestClassifier(logreg),
          param_grid=dict(estimator__C=c),
          n_jobs=8,
          cv=5,
          verbose=0,
      )
      clf.fit(X_train, y_train)
  
      y_pred = clf.predict_proba(X_test)
      y_pred = prob_to_one_hot(y_pred)
  
      micro = f1_score(y_test, y_pred, average="micro")
      macro = f1_score(y_test, y_pred, average="macro")
  
      return {"F1Mi": micro, "F1Ma": macro}
  
file_path: dgl/examples/pytorch/grace/eval.py
imports: import functools
  import numpy
  from sklearn.linear_model import LogisticRegression
  from sklearn.metrics import f1_score
  from sklearn.model_selection import GridSearchCV, train_test_split
  from sklearn.multiclass import OneVsRestClassifier
  from sklearn.preprocessing import normalize, OneHotEncoder
label_desc: Use image node_id 4 for calling a global function with example usage: label_classification(embeddings, y, train_mask, test_mask, split, ratio) and returns: dict