scikit-learn/scikit-learn — pull request #909 by larsmans (2012-06-15 17:18:43+00:00)
Title: WIP feature hashing transformer

Here's an early PR for a feature hasher for large-scale learning or memory-restricted prediction.

It implements [Weinberger et al.](alex.smola.org/papers/2009/Weinbergeretal09.pdf)'s algorithm, except that it cuts one corner: instead of running two hash functions on the input, it runs a single one, taking its lowest bit to determine the sign and the rest to determine the column index. That should be with a 32-bit hash function, as `scipy.sparse` matrices cannot hold more than 2**31-1 elements anyway.

Todo:

* Support multiple hash functions, in particular @ogrisel's implementation of murmurhash.
* Do we want to support the same style of input as `DictVectorizer`? I have a gut feeling that that's going to slow things down. If we don't, we should explicitly document this.
* Needs optimization.
* Needs more tests.
* More documentation needed.