|
TPCCLIB
|
Fuzzy C means clustering algorithm. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <string.h>#include "tpcfcmc.h"Go to the source code of this file.
Functions | |
| void | fcmcInit (FCMC *fcmc) |
| void | fcmcFree (FCMC *fcmc) |
| int | fcmcAllocate (FCMC *fcmc, unsigned int sampleNr, unsigned int dimNr, unsigned int clusterNr) |
| void | fcmcPrint (FCMC *fcmc, FILE *fp) |
| double | fcmcEuclideanDistances (FCMC *fcmc, unsigned int si, unsigned int ci) |
| int | fcmcClusterInitialize (FCMC *fcmc, const int cinit, int verbose) |
| int | fcmclustering (FCMC *fcmc, const int cinit, int verbose) |
Fuzzy C means clustering algorithm.
Definition in file fcmc.c.
| int fcmcAllocate | ( | FCMC * | fcmc, |
| unsigned int | sampleNr, | ||
| unsigned int | dimNr, | ||
| unsigned int | clusterNr ) |
Free memory allocated for FCMC data. All contents are destroyed.
| fcmc | Pointer to FCMC struct; any pre-existing contents are deleted. |
| sampleNr | Number of data samples. |
| dimNr | Number of dimensions for each sample. |
| clusterNr | Number of clusters. |
Definition at line 69 of file fcmc.c.
| int fcmcClusterInitialize | ( | FCMC * | fcmc, |
| const int | cinit, | ||
| int | verbose ) |
Initialize cluster centres. You probably want to replace this function with one tailored for your data; this works only if sample numbers are reasonably well balanced between clusters.
Reference: Yedla M, Pathakota SR, Srinivasa TM. Enhancing K-means clustering algorithm with improved initial center. Int J Comp Sci Inform Technol. 2010;1(2): 121-125.
| fcmc | Pointer to FCMC struct. |
| cinit | Initialization method:
|
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 220 of file fcmc.c.
Referenced by fcmclustering().
| double fcmcEuclideanDistances | ( | FCMC * | fcmc, |
| unsigned int | si, | ||
| unsigned int | ci ) |
Euclidean distance for fuzzy C means clustering.
| fcmc | Pointer to FCMC struct. |
| si | Sample index [0..sampleNr-1]. |
| ci | Cluster index [0..clusterNr-1]. |
Definition at line 176 of file fcmc.c.
Referenced by fcmclustering().
| void fcmcFree | ( | FCMC * | fcmc | ) |
Free memory allocated for FCMC data. All contents are destroyed.
| fcmc | Pointer to FCMC struct; |
Definition at line 43 of file fcmc.c.
Referenced by fcmcAllocate().
| void fcmcInit | ( | FCMC * | fcmc | ) |
Initiate the FCMC struct before any use.
| fcmc | Pointer to FCMC struct. |
Definition at line 21 of file fcmc.c.
Referenced by fcmcFree().
| int fcmclustering | ( | FCMC * | fcmc, |
| const int | cinit, | ||
| int | verbose ) |
Fuzzy C means clustering. Works, but code optimization still needed.
The following parameters in FCMC struct can be changed before calling this function:
This code and its tests are based on C code in https://github.com/JRC1995/Fuzzy-C-Mean.
References:
| fcmc | Pointer to filled FCMC struct. |
| cinit | Initialize cluster centres locally: 0=no (user has already initialized those), 1=yes (using fcmcClusterInitialize() with sample distances to mean), 2=yes (using fcmcClusterInitialize() with sample distances to zero). |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 326 of file fcmc.c.
| void fcmcPrint | ( | FCMC * | fcmc, |
| FILE * | fp ) |
Print the contents of FCMC data struct into specified file pointer.
| fcmc | Pointer to FCMC struct. |
| fp | File pointer, usually stdout. |
Definition at line 132 of file fcmc.c.
Referenced by fcmclustering().