class_docstr: Recommends lists of items for users.
class_docstr_tok: ["Recommends","lists","of","items","for","users","."]
docstr: Ensure that an algorithm is a :class:`Recommender`.  If it is not a recommender,
  it is wrapped in a :class:`lenskit.basic.TopN` with a default candidate selector.
  
  .. note::
      Since 0.6.0, since algorithms are fit directly, you should call this method
      **before** calling :meth:`Algorithm.fit`, unless you will always be passing
      explicit candidate sets to :meth:`recommend`.
  
  Args:
      algo(Predictor): the underlying rating predictor.
docstr_tok: ["Ensure","that","an","algorithm","is","a",":","class",":","`","Recommender","`",".","If","it","is","not","a","recommender",",","it","is","wrapped","in","a",":","class",":","`","lenskit.basic.TopN","`","with","a","default","candidate","selector",".","..","note",":",":","Since","0.6.0",",","since","algorithms","are","fit","directly",",","you","should","call","this","method","*","*","before","*","*","calling",":","meth",":","`","Algorithm.fit","`",",","unless","you","will","always","be","passing","explicit","candidate","sets","to",":","meth",":","`","recommend","`",".","Args",":","algo","(","Predictor",")",":","the","underlying","rating","predictor","."]
code: def adapt(cls, algo):
      """
      Ensure that an algorithm is a :class:`Recommender`.  If it is not a recommender,
      it is wrapped in a :class:`lenskit.basic.TopN` with a default candidate selector.
  
      .. note::
          Since 0.6.0, since algorithms are fit directly, you should call this method
          **before** calling :meth:`Algorithm.fit`, unless you will always be passing
          explicit candidate sets to :meth:`recommend`.
  
      Args:
          algo(Predictor): the underlying rating predictor.
      """
      from .basic import TopN
  
      if isinstance(algo, Recommender):
          return algo
      else:
          return TopN(algo)
  
file_path: lkpy/lenskit/algorithms/__init__.py
imports: from abc import ABCMeta, abstractmethod
  import inspect
label_desc: Use image node_id 2 for calling the Recommender obj's underlying member method code with example usage: obj.adapt(cls, algo) and returns: algo, TopN