scikit-learn/scikit-learn — pull request #2217 by vene (2013-07-25 08:31:49+00:00)
Title: MRG backwards compatibility in FastICA estimator

After some thinking I think this is the cleanest way to change the FastICA estimator according to the new compute_sources parameter.

Ideally (if there were no users) the estimator wouldn't have a `compute_sources` init argument, because the use case is different: either you use `FastICA.fit_transform`, in which case you call the underlying function with `compute_sources=True`, or you use `FastICA.fit`, in which case it's more effective not to compute the sources, because presumably the user will subsequently call `.transform` on some other data. (If they will use the same data, it's their fault for misusing the API)

In order to get there we need to deprecate the `FastICA.sources_` attribute. Because its computation depends on the initial data passed to `fit` I couldn't compute it lazily, so until the deprecation I propose to just compute it all the time. (this is identical to what FastICA did yesterday night before my nocturnal bugfix anyway).

Alternatively if we want to make the estimator be able to save the memory, we could introduce a deprecated-since-birth init attribute `compute_sources`, `True` by default. However I think this is just confusing for users; if people want to use fastica and save memory they should simply call the function directly.

In general I think the API can be rethought in many places, many estimators have tons of parameters that are only useful for speedup/optimization and all they do is expose the underlying functions with complicated logic. I think that users who really work at the limit of their resources should go ahead and use the underlying public functions.

Opinions?