def fit(self, X, y):
        X = np.array(X)
        if X.shape[1] != self.M.shape[0]:
            raise ValueError('Data matrix X with dimensions (%d, %d)' 
            'and paramaterizing matrix M with dimensions (%d, %d) are'
            'not compatible' % (X.shape[0], X.shape[1], self.M.shape[0], 
            self.M.shape[1]))
        X = np.dot(X, self.M)
        return super(ParameterizedKNeighborsClassifier, self).fit(X, y)
Before using KNeighborsClassifier.fit
dataset/ETHPy150Open johncollins/metric-learn/metric_learn/ParameterizedKNeighborsClassifier.py/ParameterizedKNeighborsClassifier.fit