class_docstr: Rank documents according to their tfidf scores and popularities. It is not a standalone ranker,
  it should be used for re-ranking the results of TF-IDF Ranker.
  
  Based on a Logistic Regression trained on 3 features:
  
  * tfidf score of the article
  * popularity of the article obtained via Wikimedia REST API as a mean number of views for the period since 2017/11/05 to 2018/11/05
  * multiplication of the two features above
  
  Args:
      pop_dict_path: a path to json file with article title to article popularity map
      load_path: a path to saved logistic regression classifier
      top_n: a number of doc ids to return
      active: whether to return a number specified by :attr:`top_n` (``True``) or all ids
       (``False``)
  
  Attributes:
      pop_dict: a map of article titles to their popularity
      mean_pop: mean popularity of all popularities in :attr:`pop_dict`, use it when popularity is not found
      clf: a loaded logistic regression classifier
      top_n: a number of doc ids to return
      active: whether to return a number specified by :attr:`top_n` or all ids
class_docstr_tok: ["Rank","documents","according","to","their","tfidf","scores","and","popularities",".","It","is","not","a","standalone","ranker",",","it","should","be","used","for","re-ranking","the","results","of","TF-IDF","Ranker",".","Based","on","a","Logistic","Regression","trained","on","3","features",":","*","tfidf","score","of","the","article","*","popularity","of","the","article","obtained","via","Wikimedia","REST","API","as","a","mean","number","of","views","for","the","period","since","2017\/11\/05","to","2018\/11\/05","*","multiplication","of","the","two","features","above","Args",":","pop_dict_path",":","a","path","to","json","file","with","article","title","to","article","popularity","map","load_path",":","a","path","to","saved","logistic","regression","classifier","top_n",":","a","number","of","doc","ids","to","return","active",":","whether","to","return","a","number","specified","by",":","attr",":","`","top_n","`","(","``","True","``",")","or","all","ids","(","``","False","``",")","Attributes",":","pop_dict",":","a","map","of","article","titles","to","their","popularity","mean_pop",":","mean","popularity","of","all","popularities","in",":","attr",":","`","pop_dict","`",",","use","it","when","popularity","is","not","found","clf",":","a","loaded","logistic","regression","classifier","top_n",":","a","number","of","doc","ids","to","return","active",":","whether","to","return","a","number","specified","by",":","attr",":","`","top_n","`","or","all","ids"]
code: def __init__(
      self,
      pop_dict_path: str,
      load_path: str,
      top_n: int = 3,
      active: bool = True,
      **kwargs,
  ) -> None:
      pop_dict_path = expand_path(pop_dict_path)
      logger.debug(
          f"Reading popularity dictionary from {pop_dict_path}"
      )
      self.pop_dict = read_json(pop_dict_path)
      self.mean_pop = np.mean(list(self.pop_dict.values()))
      load_path = expand_path(load_path)
      logger.debug(f"Loading popularity ranker from {load_path}")
      self.clf = joblib.load(load_path)
      self.top_n = top_n
      self.active = active
  
file_path: DeepPavlov/deeppavlov/models/doc_retrieval/pop_ranker.py
imports: from logging import getLogger
  from operator import itemgetter
  from typing import List, Any, Tuple
  import numpy
  import joblib
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.file import read_json
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.estimator import Component
label_desc: Use image node_id 1 to create a new PopRanker object from inherited base classes: Component with example: obj = PopRanker(pop_dict_path, load_path, top_n, active)