check_memory#
- sklearn.utils.validation.check_memory(memory)[source]#
check that
memory
is joblib.Memory-like.joblib.Memory-like means that
memory
can be converted into a joblib.Memory instance (typically a str denoting thelocation
) or has the same interface (has acache
method).- Parameters:
- memoryNone, str or object with the joblib.Memory interface
If string, the location where to create the
joblib.Memory
interface.If None, no caching is done and the Memory object is completely transparent.
- Returns:
- memoryobject with the joblib.Memory interface
A correct joblib.Memory object.
- Raises:
- ValueError
If
memory
is not joblib.Memory-like.
Examples
>>> from sklearn.utils.validation import check_memory >>> check_memory("caching_dir") Memory(location=caching_dir/joblib)