class_docstr: Node2vec model from paper node2vec: Scalable Feature Learning for Networks <https://arxiv.org/abs/1607.00653>
  Attributes
  ----------
  g: DGLGraph
      The graph.
  embedding_dim: int
      Dimension of node embedding.
  walk_length: int
      Length of each trace.
  p: float
      Likelihood of immediately revisiting a node in the walk.  Same notation as in the paper.
  q: float
      Control parameter to interpolate between breadth-first strategy and depth-first strategy.
      Same notation as in the paper.
  num_walks: int
      Number of random walks for each node. Default: 10.
  window_size: int
      Maximum distance between the center node and predicted node. Default: 5.
  num_negatives: int
      The number of negative samples for each positive sample.  Default: 5.
  use_sparse: bool
      If set to True, use PyTorch's sparse embedding and optimizer. Default: ``True``.
  weight_name : str, optional
      The name of the edge feature tensor on the graph storing the (unnormalized)
      probabilities associated with each edge for choosing the next node.
  
      The feature tensor must be non-negative and the sum of the probabilities
      must be positive for the outbound edges of all nodes (although they don't have
      to sum up to one).  The result will be undefined otherwise.
  
      If omitted, DGL assumes that the neighbors are picked uniformly.
class_docstr_tok: ["Node2vec","model","from","paper","node2vec",":","Scalable","Feature","Learning","for","Networks","<","https",":","\/\/arxiv.org\/abs\/1607.00653",">","Attributes","--","--","--","--","--","g",":","DGLGraph","The","graph",".","embedding_dim",":","int","Dimension","of","node","embedding",".","walk_length",":","int","Length","of","each","trace",".","p",":","float","Likelihood","of","immediately","revisiting","a","node","in","the","walk",".","Same","notation","as","in","the","paper",".","q",":","float","Control","parameter","to","interpolate","between","breadth-first","strategy","and","depth-first","strategy",".","Same","notation","as","in","the","paper",".","num_walks",":","int","Number","of","random","walks","for","each","node",".","Default",":","10.","window_size",":","int","Maximum","distance","between","the","center","node","and","predicted","node",".","Default",":","5.","num_negatives",":","int","The","number","of","negative","samples","for","each","positive","sample",".","Default",":","5.","use_sparse",":","bool","If","set","to","True",",","use","PyTorch","'s","sparse","embedding","and","optimizer",".","Default",":","``","True","``",".","weight_name",":","str",",","optional","The","name","of","the","edge","feature","tensor","on","the","graph","storing","the","(","unnormalized",")","probabilities","associated","with","each","edge","for","choosing","the","next","node",".","The","feature","tensor","must","be","non-negative","and","the","sum","of","the","probabilities","must","be","positive","for","the","outbound","edges","of","all","nodes","(","although","they","do","n't","have","to","sum","up","to","one",")",".","The","result","will","be","undefined","otherwise",".","If","omitted",",","DGL","assumes","that","the","neighbors","are","picked","uniformly","."]
docstr: Evaluate the quality of embedding vector via a downstream classification task with logistic regression.
docstr_tok: ["Evaluate","the","quality","of","embedding","vector","via","a","downstream","classification","task","with","logistic","regression","."]
code: def evaluate(self, x_train, y_train, x_val, y_val):
      """
      Evaluate the quality of embedding vector via a downstream classification task with logistic regression.
      """
      x_train = self.forward(x_train)
      x_val = self.forward(x_val)
  
      x_train, y_train = x_train.cpu().numpy(), y_train.cpu().numpy()
      x_val, y_val = x_val.cpu().numpy(), y_val.cpu().numpy()
      lr = LogisticRegression(
          solver="lbfgs", multi_class="auto", max_iter=150
      ).fit(x_train, y_train)
  
      return lr.score(x_val, y_val)
  
imports: import torch
  import torch.nn
  from dgl.sampling import node2vec_random_walk
  from sklearn.linear_model import LogisticRegression
  from torch.utils.data import DataLoader
label_desc: Use image node_id 7 for calling the Node2vec obj's underlying member method code with example usage: obj.evaluate(x_train, y_train, x_val, y_val) and returns: lr