Utility Functions

Miscellaneous

Miscellaneous utility functions.

lenskit.util.clone(algo)

Clone an algorithm, but not its fitted data. This is like scikit.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.basic import Bias
>>> orig = Bias()
>>> copy = clone(orig)
>>> copy is orig
False
>>> copy.damping == orig.damping
True
lenskit.util.cur_memory()

Get the current memory use for this process

lenskit.util.max_memory()

Get the maximum memory use for this process