Please never call `todense()` but call instead `toarray()` to never deal with `numpy.matrix` instance as part of the scikit-learn code base.