How to use GridSearchCV with RidgeClassifier
The problem is that Y has shape (15780,1). The shape of Y should show (15780,). The explanation for this is a bit long, so I just give here the links-

Difference between shapes (R,1) and (R,)

Solution for IndexError: too many indices for array