def predict(self, X):
        check_is_fitted(self, "cluster_centers_indices_")
        if not hasattr(self, "cluster_centers_"):
            raise ValueError("Predict method is not supported when "
                             "affinity='precomputed'.")

        return pairwise_distances_argmin(X, self.cluster_centers_)
Predict the closest cluster each sample in X belongs to.
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/cluster/affinity_propagation_.py/AffinityPropagation.predict