Please replace calls to `todense()` by calls to `toarray()`. `todense()` returns a `numpy.matrix` instance which has a a confusing API and we would rather not silently introduce instances of that class in the scikit-learn codebase, even in the tests.