ContextLab / hypertools

A Python toolbox for gaining geometric insights into high-dimensional data
http://hypertools.readthedocs.io/en/latest/
MIT License
1.83k stars 160 forks source link

memoize function doesn't consider default function args before caching #158

Open andrewheusser opened 7 years ago

andrewheusser commented 7 years ago

The memoize function could be extended by considering the default arguments before caching is done. for example:

hyp.reduce(data, reduce='IncrementalPCA', ndims=5) and hyp.reduce(data, ndims=5)

do the same thing since the default reduction model is IncrementalPCA. However, because the cache key is a str comprised of the inputs, they are not treated as the same. Considering the default arguments before adding to the cache would speed things up in some cases.