I am a bit surprised that the shape of this matrix has n_samples last. This is contrary to conventions, both in scikit-learn and in your code.