Python implementation of Clustering with Bregman Divergences as a scikit-learn
module:
- Banerjee, A., Merugu, S., Dhillon, I. S., & Ghosh, J. (2005). Clustering with Bregman divergences. Journal of machine learning research, 6(Oct), 1705-1749. pdf
If you have anaconda installed, you can create an environment with the dependences as follows:
conda env create -f requirements.yml
Then, you must activate the environment:
source activate env
or
conda activate env
You can install this package via setuptools
:
python setup.py install
You can use the models as you usually do in sklearn:
from bregclus.models import BregmanHard
from bregclus.divergences import euclidean
import numpy as np
X = np.random.uniform(size=(100, 2))
model = BregmanHard(n_clusters=5, divergence=euclidean)
model.fit(X)
y_pred = model.predict(X)
Feel free to check the example codes: examples/
python euclidean_hard.py
python mahalanobis_hard.py