class_docstr: Base class for ranking models.
  
  Parameters
  ----------
  seed
      Random number generation seed. Set this for reproducibility.
class_docstr_tok: ["Base","class","for","ranking","models",".","Parameters","--","--","--","--","--","seed","Random","number","generation","seed",".","Set","this","for","reproducibility","."]
docstr: Rank models by decreasing order of preference for a given user.
  
  Parameters
  ----------
  user
      A user ID.
  items
      A set of items to rank.
  x
      Optional context to use.
docstr_tok: ["Rank","models","by","decreasing","order","of","preference","for","a","given","user",".","Parameters","--","--","--","--","--","user","A","user","ID",".","items","A","set","of","items","to","rank",".","x","Optional","context","to","use","."]
code: def rank(
      self, user: ID, items: set[ID], x: dict | None = None
  ) -> list[ID]:
      """Rank models by decreasing order of preference for a given user.
  
      Parameters
      ----------
      user
          A user ID.
      items
          A set of items to rank.
      x
          Optional context to use.
  
      """
      preferences = {
          item: self.predict_one(user, item, x) for item in items
      }
      return sorted(
          preferences, key=preferences.__getitem__, reverse=True
      )
  
file_path: river/river/reco/base.py
imports: from __future__ import annotations
  import abc
  import numbers
  import random
  import typing
  from river import base
label_desc: Use image node_id 5 for calling the Ranker obj's underlying member method code with example usage: obj.rank(user, items, x) and returns: sorted