The general algorithm to run Kernel k-Harmonic Means and Kernel Fuzzy c-Means.
>>> import numpy as np
>>> X = np.array([
... [10, 11], [12, 13], [14, 15], [-10, -11], [-12, -13], [-14, -15]
... ])
>>> y = np.array([0, 0, 0, 1, 1, 1])
>>> k = 2
>>> centers, mem, cost = kernel_gfcm(X, n_clusters=k)
>>> print(centers)
[[ 12. 13.]
[-12. -13.]]
>>> print(mem)
[0 0 0 1 1 1]
>>> print(cost)
1.981515079547317
>>> from sklearn.metrics import adjusted_rand_score as ARI
>>> print('ARI =', ARI(y, mem))
ARI = 1.0
The folder large_num_clusters contains the files to conduct the experiment (reported in the source paper) comparing the performance of Kernel k-Harmonic Means with Kernel Fuzzy c-Means, Kernel k-Means, and BIRCH.