class_docstr: Class for ranking of paths in subgraph
class_docstr_tok: ["Class","for","ranking","of","paths","in","subgraph"]
docstr: Args:
      load_path: path to folder with wikidata files
      rel_q2name_filename: name of file which maps relation id to name
      return_elements: what elements return in output
      ranker: component deeppavlov.models.ranking.rel_ranker
      wiki_parser: component deeppavlov.models.wiki_parser
      batch_size: infering batch size
      softmax: whether to process relation scores with softmax function
      use_api_requester: whether wiki parser will be used as external api
      rank: whether to rank relations or simple copy input
      nll_rel_ranking: whether use components trained with nll loss for relation ranking
      nll_path_ranking: whether use components trained with nll loss for relation path ranking
      top_possible_answers: number of answers returned for a question in each list of candidate answers
      top_n: number of lists of candidate answers returned for a question
      pos_class_num: index of positive class in the output of relation ranking model
      rel_thres: threshold of relation confidence
      type_rels: list of relations in the knowledge base which connect an entity and its type 
      **kwargs:
docstr_tok: ["Args",":","load_path",":","path","to","folder","with","wikidata","files","rel_q2name_filename",":","name","of","file","which","maps","relation","id","to","name","return_elements",":","what","elements","return","in","output","ranker",":","component","deeppavlov.models.ranking.rel_ranker","wiki_parser",":","component","deeppavlov.models.wiki_parser","batch_size",":","infering","batch","size","softmax",":","whether","to","process","relation","scores","with","softmax","function","use_api_requester",":","whether","wiki","parser","will","be","used","as","external","api","rank",":","whether","to","rank","relations","or","simple","copy","input","nll_rel_ranking",":","whether","use","components","trained","with","nll","loss","for","relation","ranking","nll_path_ranking",":","whether","use","components","trained","with","nll","loss","for","relation","path","ranking","top_possible_answers",":","number","of","answers","returned","for","a","question","in","each","list","of","candidate","answers","top_n",":","number","of","lists","of","candidate","answers","returned","for","a","question","pos_class_num",":","index","of","positive","class","in","the","output","of","relation","ranking","model","rel_thres",":","threshold","of","relation","confidence","type_rels",":","list","of","relations","in","the","knowledge","base","which","connect","an","entity","and","its","type","*","*","kwargs",":"]
code: def __init__(
      self,
      load_path: str,
      rel_q2name_filename: str,
      return_elements: List[str] = None,
      ranker: Chainer = None,
      wiki_parser: Optional[WikiParser] = None,
      batch_size: int = 32,
      softmax: bool = False,
      use_api_requester: bool = False,
      rank: bool = True,
      nll_rel_ranking: bool = False,
      nll_path_ranking: bool = False,
      top_possible_answers: int = -1,
      top_n: int = 1,
      pos_class_num: int = 1,
      rel_thres: float = 0.0,
      type_rels: List[str] = None,
      **kwargs,
  ):
      """
  
      Args:
          load_path: path to folder with wikidata files
          rel_q2name_filename: name of file which maps relation id to name
          return_elements: what elements return in output
          ranker: component deeppavlov.models.ranking.rel_ranker
          wiki_parser: component deeppavlov.models.wiki_parser
          batch_size: infering batch size
          softmax: whether to process relation scores with softmax function
          use_api_requester: whether wiki parser will be used as external api
          rank: whether to rank relations or simple copy input
          nll_rel_ranking: whether use components trained with nll loss for relation ranking
          nll_path_ranking: whether use components trained with nll loss for relation path ranking
          top_possible_answers: number of answers returned for a question in each list of candidate answers
          top_n: number of lists of candidate answers returned for a question
          pos_class_num: index of positive class in the output of relation ranking model
          rel_thres: threshold of relation confidence
          type_rels: list of relations in the knowledge base which connect an entity and its type
          **kwargs:
      """
      super().__init__(save_path=None, load_path=load_path)
      self.rel_q2name_filename = rel_q2name_filename
      self.ranker = ranker
      self.wiki_parser = wiki_parser
      self.batch_size = batch_size
      self.softmax = softmax
      self.return_elements = return_elements or list()
      self.use_api_requester = use_api_requester
      self.rank = rank
      self.nll_rel_ranking = nll_rel_ranking
      self.nll_path_ranking = nll_path_ranking
      self.top_possible_answers = top_possible_answers
      self.top_n = top_n
      self.pos_class_num = pos_class_num
      self.rel_thres = rel_thres
      self.type_rels = type_rels or set()
      self.load()
  
file_path: DeepPavlov/deeppavlov/models/kbqa/rel_ranking_infer.py
imports: from logging import getLogger
  from typing import Tuple, List, Any, Optional
  from scipy.special import softmax
  from deeppavlov.core.common.chainer import Chainer
  from deeppavlov.core.common.file import load_pickle, read_json
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.component import Component
  from deeppavlov.core.models.serializable import Serializable
  from deeppavlov.models.kbqa.sentence_answer import sentence_answer
  from deeppavlov.models.kbqa.wiki_parser import WikiParser
label_desc: Use image node_id 1 to create a new RelRankerInfer object from inherited base classes: Component, Serializable with example: obj = RelRankerInfer(load_path, rel_q2name_filename, return_elements, ranker, wiki_parser, batch_size, softmax, use_api_requester, rank, nll_rel_ranking, nll_path_ranking, top_possible_answers, top_n, pos_class_num, rel_thres, type_rels)