defuzzify | R Documentation |
Transforms a fuzzy classification into a crisp (hard) classification.
defuzzify(object, method = "max", alpha = 0.5, na.rm = FALSE)
object |
A site-by-group fuzzy membership matrix. Alternatively, an object of class 'vegclust' or 'vegclass'. |
method |
Either |
alpha |
Threshold for the alpha-cut, bounded between 0 and 1. |
na.rm |
If |
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.
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. |
Miquel De Cáceres, CREAF.
Davé, R. N. and R. Krishnapuram (1997) Robust clustering methods: a unified view. IEEE Transactions on Fuzzy Systems 5, 270-293.
vegclust
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.