sklearn.utils.Memory

Warning

DEPRECATED

class sklearn.utils.Memory(**kwargs)[source]
Attributes:
cachedir

Methods

cache([func, ignore, verbose, mmap_mode]) Decorates the given function func to only compute its return value for input arguments not cached on disk.
clear([warn]) Erase the complete cache directory.
eval(func, *args, **kwargs) Eval function func with arguments *args and **kwargs, in the context of the memory.
format(obj[, indent]) Return the formatted representation of the object.
reduce_size() Remove cache elements to make cache size fit in bytes_limit.
debug  
warn  
__init__(**kwargs)[source]

DEPRECATED: deprecated in version 0.20.1 to be removed in version 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib.

cache(func=None, ignore=None, verbose=None, mmap_mode=False)[source]

Decorates the given function func to only compute its return value for input arguments not cached on disk.

Parameters:
func: callable, optional

The function to be decorated

ignore: list of strings

A list of arguments name to ignore in the hashing

verbose: integer, optional

The verbosity mode of the function. By default that of the memory object is used.

mmap_mode: {None, ‘r+’, ‘r’, ‘w+’, ‘c’}, optional

The memmapping mode used when loading from cache numpy arrays. See numpy.load for the meaning of the arguments. By default that of the memory object is used.

Returns:
decorated_func: MemorizedFunc object

The returned object is a MemorizedFunc object, that is callable (behaves like a function), but offers extra methods for cache lookup and management. See the documentation for joblib.memory.MemorizedFunc.

clear(warn=True)[source]

Erase the complete cache directory.

eval(func, *args, **kwargs)[source]

Eval function func with arguments *args and **kwargs, in the context of the memory.

This method works similarly to the builtin apply, except that the function is called only if the cache is not up to date.

format(obj, indent=0)[source]

Return the formatted representation of the object.

reduce_size()[source]

Remove cache elements to make cache size fit in bytes_limit.