defuzzify: Defuzzifies a fuzzy partition

View source: R/defuzzify.R

defuzzifyR Documentation

Defuzzifies a fuzzy partition

Description

Transforms a fuzzy classification into a crisp (hard) classification.

Usage

defuzzify(object, method = "max", alpha = 0.5, na.rm = FALSE)

Arguments

object

A site-by-group fuzzy membership matrix. Alternatively, an object of class 'vegclust' or 'vegclass'.

method

Either "max" to choose for the maximum membership value across clusters, or "cut" for an alpha-cut.

alpha

Threshold for the alpha-cut, bounded between 0 and 1.

na.rm

If TRUE removes the objects that do not belong to any cluster when using method="cut".

Details

Alpha-cut means that memberships lower than alpha are transformed into 0 while memberships higher than alpha are transformed into 1. This means that if alpha values are low (i.e. close to 0), an object may belong to more than one group after defuzzification. These will generate a concatenation of cluster names in the output cluster vector and a row with sum more than one in the memb matrix). Similarly, if alpha is high (i.e. close to 1) there are objects that may be left unclassified. These will get NA in the cluster vector and zero row in the memb matrix.

Value

A list with the following items:

memb

A data frame with the hard membership partition.

cluster

A vector (factor) with the name of the cluster for each object.

Author(s)

Miquel De Cáceres, CREAF.

References

Davé, R. N. and R. Krishnapuram (1997) Robust clustering methods: a unified view. IEEE Transactions on Fuzzy Systems 5, 270-293.

See Also

vegclust

Examples

## Loads data  
data(wetland)
  
## This equals the chord transformation 
## (see also  \code{\link{decostand}} in package vegan)
wetland.chord = as.data.frame(sweep(as.matrix(wetland), 1, 
                              sqrt(rowSums(as.matrix(wetland)^2)), "/"))

## Create noise clustering with 3 clusters. Perform 10 starts from random seeds 
## and keep the best solution
wetland.nc = vegclust(wetland.chord, mobileCenters=3, m = 1.2, dnoise=0.75, 
                      method="NC", nstart=10)

## Defuzzification using an alpha-cut (alpha=0.5)
wetland.nc.df = defuzzify(wetland.nc$memb, method="cut")

## Cluster vector, with 'N' for objects that are unclassified, 
## and 'NA' for objects that are intermediate
print(wetland.nc.df$cluster)

## Hard membership matrix (site 22 does not get any cluster assigned)
print(wetland.nc.df$memb)


emf-creaf/vegclust documentation built on July 27, 2024, 7:32 a.m.