code: def clone(algo):
      """
      Clone an algorithm, but not its fitted data.  This is like
      :func:`sklearn.base.clone`, but may not work on arbitrary SciKit estimators.
      LensKit algorithms are compatible with SciKit clone, however, so feel free
      to use that if you need more general capabilities.
  
      This function is somewhat derived from the SciKit one.
  
      >>> from lenskit.algorithms.bias import Bias
      >>> orig = Bias()
      >>> copy = clone(orig)
      >>> copy is orig
      False
      >>> copy.damping == orig.damping
      True
      """
      _log.debug("cloning %s", algo)
      if isinstance(algo, Algorithm) or hasattr(algo, "get_params"):
          params = algo.get_params(deep=False)
  
          sps = dict([(k, clone(v)) for (k, v) in params.items()])
          return algo.__class__(**sps)
      elif isinstance(algo, list) or isinstance(algo, tuple):
          return [clone(a) for a in algo]
      else:
          return deepcopy(algo)
  
file_path: lkpy/lenskit/util/__init__.py
imports: import logging
  from textwrap import dedent
  from copy import deepcopy
  from ..algorithms import Algorithm
  from .log import log_to_notebook, log_to_stderr
  from .timing import Stopwatch
  from .random import derivable_rng
  from .parallel import proc_count
label_desc: Use image node_id 1 for calling a global function with example usage: clone(algo) and returns: algo, unknown, deepcopy