[MRG] Move pooling_func to constructor.

This is a partial fix for #1975.