scikit-learn/scikit-learn — pull request #2086 by jnothman (2013-06-23 06:15:44+00:00)
Title: WIP allow Pipeline to memoize partial results

This PR adds a `memory` parameter to `Pipeline` which allows it to memoize the results of partial pipeline evaluations (`fit`s, `transform`s). See [http://www.mail-archive.com/scikit-learn-general@lists.sourceforge.net/msg07402.html](a request for this feature).

Currently:
* it is a prototype, untested and not sparkling from clean code
* it requires storing the `Pipeline`'s training data on the instance (perhaps a hash would suffice)
* the implementation perhaps caches data more frequently than necessary
* `fit` and `transform` are called separately even where `fit_transform` is implemented
* it memoizes the last step (whether it be `fit`, `transform`, `score` or `predict`, etc.), perhaps unnecessarily
* it does not support passing keyword arguments to steps' `fit` methods as `Pipeline` currently does (this is the failing test)
* it does not take advantage of the fact that for some estimators only a subset of parameters produce distinct models (e.g. for `SelectKBest`, only `score_func` should be a key for `fit`, while (`score_func`, `k`) affect the result of `transform`)

@GaelVaroquaux, is this what you had in mind?
@amueller, this isn't as much a generalised CV solution (#1626) as #2000 was; to what extent does it satisfy your use-cases?