No project description provided
Project description
fuzzy-c-means
fuzzy-c-means
is a Python module implementing the Fuzzy C-means clustering algorithm.
instalation
the fuzzy-c-means
package is available in PyPI. to install, simply type the following command:
pip install fuzzy-c-means
basic usage
simple example of use the fuzzy-c-means
to cluster a dataset in tree groups:
%matplotlib inline
from fcmeans import FCM
from sklearn.datasets import make_blobs
from matplotlib import pyplot as plt
# create artifitial dataset
n_samples = 5000
n_bins = 3 # use 3 bins for calibration_curve as we have 3 clusters here
centers = [(-5, -5), (0, 0), (5, 5)]
X,_ = make_blobs(n_samples=n_samples, n_features=2, cluster_std=1.5,
centers=centers, shuffle=False, random_state=42)
# fit the fuzzy-c-means
fcm = FCM(n_clusters=3)
fcm.fit(X)
# outputs
fcm_centers = fcm.centers
fcm_labels = fcm.u.argmax(axis=1)
# plot result
f, axes = plt.subplots(1, 2, figsize=(11,5))
axes[0].scatter(X[:,0], X[:,1], alpha=.1)
axes[1].scatter(X[:,0], X[:,1], c=fcm_labels, alpha=.1)
axes[1].scatter(fcm_centers[:,0], fcm_centers[:,1], marker="s", s=100, c='white')
plt.show()
how to cite fuzzy-c-means package
if you use fuzzy-c-means
package in your paper, please cite it in your publication.
@software{dias2019fuzzy,
author = {Madson Luiz Dantas Dias},
title = {fuzzy-c-means: An implementation of Fuzzy $C$-means clustering algorithm.},
month = may,
year = 2019,
publisher = {Zenodo},
doi = {10.5281/zenodo.3066222},
url = {https://git.io/fuzzy-c-means}
}
citations
contributing
this project is open for contributions. here are some of the ways for you to contribute:
- bug reports/fix
- features requests
- use-case demonstrations
to make a contribution, just fork this repository, push the changes in your fork, open up an issue, and make a pull request!
contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fuzzy-c-means-1.2.1.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for fuzzy_c_means-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bde3d036fa53212881be68a835812c79253b51a5232ce5038268970888fa3f9f |
|
MD5 | f497a5eec9226053a137dd888d7b9232 |
|
BLAKE2b-256 | 176a680dc6725f9fbabedf3ab706c7a59a4af5d9e0b104dd828402da2cf5ab40 |