scikit-learn/scikit-learn — pull request #1382 by mblondel (2012-11-19 09:47:43+00:00)
Title: MRG: Add dummy feature utility function

This PR adds a simple utility function to the preprocessing module that adds a dummy feature (a column with all 1) to a dataset. It supports ndarrays, COO matrices and CSC matrices efficiently. For CSR matrices, it converts to COO first.

It's not used in the scikit yet but since it's not trivial to implement in the sparse case, it think it is nice to have a well-tested function for this purpose in the scikit.