https://github.com/juselara1/bregclus
Python implementation of Bregman Hard Clustering and Bregman Soft Clustering as a scikit-learn module.
https://github.com/juselara1/bregclus
bregman-divergence clustering numpy scikit-learn unsupervised-learning
Last synced: 10 months ago
JSON representation
Python implementation of Bregman Hard Clustering and Bregman Soft Clustering as a scikit-learn module.
- Host: GitHub
- URL: https://github.com/juselara1/bregclus
- Owner: juselara1
- License: mit
- Created: 2021-01-03T04:34:13.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-06T19:45:09.000Z (about 3 years ago)
- Last Synced: 2025-04-12T06:05:44.599Z (10 months ago)
- Topics: bregman-divergence, clustering, numpy, scikit-learn, unsupervised-learning
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Clustering with Bregman Divergences
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](https://www.jmlr.org/papers/volume6/banerjee05b/banerjee05b.pdf)
## Requirements
---
If you have [anaconda](https://www.anaconda.com/) installed, you can create an environment with the dependences as follows:
```sh
conda env create -f requirements.yml
```
Then, you must activate the environment:
```sh
source activate env
```
or
```sh
conda activate env
```
## Installation
---
You can install this package via `setuptools`:
```sh
python setup.py install
```
### Usage
---
You can use the models as you usually do in sklearn:
```python
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/`
```sh
python euclidean_hard.py
python mahalanobis_hard.py
```