Skip to main content

A simple implementation of Fuzzy C-means algorithm.

Project description

scikit-mlm

GitHub PyPI GitHub commit activity GitHub last commit

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:

from fcmeans import FCM
from sklearn.datasets import make_blobs
from matplotlib import pyplot as plt
from seaborn import scatterplot as scatter


# create artifitial dataset
n_samples = 50000
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.0,
                  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
%matplotlib inline
f, axes = plt.subplots(1, 2, figsize=(11,5))
scatter(X[:,0], X[:,1], ax=axes[0])
scatter(X[:,0], X[:,1], ax=axes[1], hue=fcm_labels)
scatter(fcm_centers[:,0], fcm_centers[:,1], ax=axes[1],marker="s",s=200)
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.

@misc{fuzzy-c-means,
    author       = "Madson Luiz Dantas Dias",
    year         = "2019",
    title        = "fuzzy-c-means: An implementation of Fuzzy $C$-means clustering algorithm.",
    url          = "https://github.com/omadson/fuzzy-c-means",
    institution  = "Federal University of Cear\'{a}, Department of Computer Science" 
}

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


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-0.0.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fuzzy_c_means-0.0.4-py2-none-any.whl (4.3 kB view details)

Uploaded Python 2

File details

Details for the file fuzzy-c-means-0.0.4.tar.gz.

File metadata

  • Download URL: fuzzy-c-means-0.0.4.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for fuzzy-c-means-0.0.4.tar.gz
Algorithm Hash digest
SHA256 e2a53c7cfd4da57fee51fc44643d1781fc29b6d79be344e0fa414046f0902999
MD5 965dd8259c61ad6be685be1d9e01313b
BLAKE2b-256 57844c7fe62bb554865cb899bca5036ab75d1563abaec9ae8b22382287b604e5

See more details on using hashes here.

File details

Details for the file fuzzy_c_means-0.0.4-py2-none-any.whl.

File metadata

  • Download URL: fuzzy_c_means-0.0.4-py2-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for fuzzy_c_means-0.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 1959d1411ed5795353ae893d95a0990c765716b18ace88ed2b51396b245ab090
MD5 d302afb12dec5fbfbbc05e7d6d52882d
BLAKE2b-256 5ae2a2f72be74b660b93f5862ebc6bcafb078a1dbe0a0b27a51ee560dd780f34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page