The class should have a

    @property
    def _pairwise(self):
        return self.kernel == 'precomputed'

to make it compatible with GridSearchCV.