Learn R Programming

clusternor (version 0.0-2)

FuzzyCMeans: Perform Fuzzy C-means clustering on a data matrix. A soft variant of the kmeans algorithm where each data point are assigned a contribution weight to each cluster

Description

See: https://en.wikipedia.org/wiki/Fuzzy_clustering#Fuzzy_C-means_clustering

Usage

FuzzyCMeans(data, centers, nrow = -1, ncol = -1,
  iter.max = .Machine$integer.max, nthread = -1, fuzz.index = 2,
  init = c("forgy", "none"), tolerance = 1e-06,
  dist.type = c("sqeucl", "eucl", "cos", "taxi"))

Arguments

data

Data file name on disk (NUMA optimized) or In memory data matrix

centers

Either (i) The number of centers (i.e., k), or (ii) an In-memory data matrix

nrow

The number of samples in the dataset

ncol

The number of features in the dataset

iter.max

The maximum number of iteration of k-means to perform

nthread

The number of parallel threads to run

fuzz.index

The fuzziness coefficient/index (> 1 and < inf)

init

The type of initialization to use c("forgy", "none")

tolerance

The convergence tolerance

dist.type

What dissimilarity metric to use

Value

A list containing the attributes of the output of kmeans. cluster: A vector of integers (from 1:k) indicating the cluster to which each point is allocated. centers: A matrix of cluster centres. size: The number of points in each cluster. iter: The number of (outer) iterations. contrib.mat: The data point to cluster contribution matrix

Examples

Run this code
# NOT RUN {
iris.mat <- as.matrix(iris[,1:4])
k <- length(unique(iris[, dim(iris)[2]])) # Number of unique classes
fcm <- FuzzyCMeans(iris.mat, k, iter.max=5)

# }

Run the code above in your browser using DataLab