输出值的透明快速磁盘缓存:备忘录或
为python函数创建类似的功能
任意的python对象,包括非常大的numpy数组。分开
域逻辑或算法的持久性和流执行逻辑
通过将操作作为一组定义良好的步骤编写代码
输入和输出:python函数。joblib可以保存
计算到磁盘并仅在必要时重新运行:>>> from joblib import Memory
>>> cachedir = 'your_cache_dir_goes_here'
>>> mem = Memory(cachedir)
>>> import numpy as np
>>> a = np.vander(np.arange(3)).astype(np.float)
>>> square = mem.cache(np.square)
>>> b = square(a) # doctest: +ELLIPSIS
________________________________________________________________________________
[Memory] Calling square...
square(array([[0., 0., 1.],
[1., 1., 1.],
[4., 2., 1.]]))
___________________________________________________________square - 0...s, 0.0min
>>> c = square(a)
>>> # The above call did not trigger an evaluation