class_docstr: This Evaluator is meant for datasets such as FB15K, FB15K-237, WN18, WN18RR
  used in knowledge base completion. We only support one non featurized,
  non-partitioned entity type and evaluation with all negatives to be
  comparable to standard benchmarks.
class_docstr_tok: ["This","Evaluator","is","meant","for","datasets","such","as","FB15K",",","FB15K-237",",","WN18",",","WN18RR","used","in","knowledge","base","completion",".","We","only","support","one","non","featurized",",","non-partitioned","entity","type","and","evaluation","with","all","negatives","to","be","comparable","to","standard","benchmarks","."]
code: def _adjust_scores(self, scores: Scores, batch_edges: EdgeList):
      for idx in range(len(batch_edges)):
          # Assume non-featurized.
          cur_lhs = int(batch_edges.lhs.to_tensor()[idx])
          # Assume dynamic relations.
          cur_rel = int(batch_edges.rel[idx])
          # Assume non-featurized.
          cur_rhs = int(batch_edges.rhs.to_tensor()[idx])
  
          rhs_edges_filtered = self.lhs_map[cur_lhs, cur_rel]
          lhs_edges_filtered = self.rhs_map[cur_rhs, cur_rel]
          assert cur_lhs in lhs_edges_filtered
          assert cur_rhs in rhs_edges_filtered
  
          # The rank is computed as the number of non-negative margins (as
          # that means a negative with at least as good a score as a positive)
          # so to avoid counting positives we give them a negative margin.
          scores.lhs_neg[idx][lhs_edges_filtered] = -1e9
          scores.rhs_neg[idx][rhs_edges_filtered] = -1e9
  
file_path: PyTorch-BigGraph/torchbiggraph/filtered_eval.py
imports: import logging
  from collections import defaultdict
  from typing import Dict, List, Tuple
  from torchbiggraph.config import ConfigSchema
  from torchbiggraph.edgelist import EdgeList
  from torchbiggraph.eval import RankingEvaluator
  from torchbiggraph.graph_storages import EDGE_STORAGES
  from torchbiggraph.losses import LOSS_FUNCTIONS
  from torchbiggraph.model import Scores
  from torchbiggraph.stats import Stats
  from torchbiggraph.types import UNPARTITIONED
label_desc: Use image node_id 2 for calling the FilteredRankingEvaluator obj's underlying member method code with example usage: obj._adjust_scores(scores, batch_edges) without return types