Skip to main content

A python package for Weighted Cluster Fuzzy-k-Centers algorithm

Project description

Python implementations of the Weighted CLuster FuzzykCenters algorithms for fuzzy clustering categorical data:

Installation:

Using pip:

pip install wcfkcenters

Import the packages:

from WCFkCenters.WCFkCenters import WCFkCenters
from WCFkCenters import TDef
import numpy as np

Generate a simple categorical dataset:

X = np.array([[0,0,0],[0,1,1],[0,0,0],[1,0,1],[2,2,2],[2,3,2],[2,3,2]])
y = np.array([0,0,0,0,1,1,1])

LSHk-Representatives (Init):

algo = WCFkCenters(X,y ,k=TDef.k, alpha=TDef.alpha)
algo.SetupMeasure("Overlap")
algo.DoCluster()
algo.CalcScore()

Built-in evaluattion metrics:

algo.CalcFuzzyScore()

Outcome:

SKIP LOADING distMatrix because: True bd=None yellow
Saving Overlap to: saved_dist_matrices/json/Overlap_None.json
>>> algo.DoCluster()
array([0, 0, 0, 0, 1, 1, 1], dtype=int64)
>>> algo.CalcScore()
Purity: 1.00 NMI: 1.00 ARI: 1.00 Sil:  0.59 Acc: 1.00 Recall: 1.00 Precision: 1.00
(1.0, 1.0, 1.0, 1.0, 1.0, 0.5873015873015872, 0.011969540000001189, -1, 1.0, 1.0, 1.0)
Fuzzy scores PC:1.00 NPC:1.00 FHV↓:0.02 FS↓:-2000.00 XB↓:0.11 BH↓:0.06 BWS:-2000.00 FPC:3.49 SIL_R:0.70 FSIL:0.70 MPO:12.18 NPE:0.01 PE:0.01 PEB:0.01

Parameters:

X: Categorical dataset
y: Labels of object (for evaluation only)
n_init: Number of initializations
n_clusters: Number of target clusters
max_iter: Maximum iterations
verbose:
random_state:

Outputs:

cluster_representatives: List of final representatives
labels_: Prediction labels
u: Fuzzy membership cost_: Final sum of squared distance from objects to their centroids
n_iter_: Number of iterations\

References:

To be updated

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

wcfkcenters-0.0.7.tar.gz (16.7 kB view details)

Uploaded Source

File details

Details for the file wcfkcenters-0.0.7.tar.gz.

File metadata

  • Download URL: wcfkcenters-0.0.7.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for wcfkcenters-0.0.7.tar.gz
Algorithm Hash digest
SHA256 96a0cfc0a1e08140380dddf40fa85fd6e5dfdf10a26962ce2760f32f2643ed98
MD5 7a1d0229d2e95fdd1ffda0e9fe7af773
BLAKE2b-256 a3c671e7795f9e8c145b2a9bd6c499924c132fb485632f051a22a713d9c471f3

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