Learn R Programming

rtemis (version 1.4.3)

get_membership: Get cluster membership from a soft Clustering

Description

Returns, for each case of the data a soft clustering was fitted on, its weight on each cluster: a fuzzy membership degree for c-means, a posterior probability for a Gaussian mixture model.

Usage

get_membership(x)

Value

data.table: One row per case, one column per cluster.

Arguments

x

Clustering: A soft Clustering object, produced by an algorithm such as CMeans or GMM.

Author

EDG

Details

Column j is named "j" and corresponds to cluster label j in the output of clusters(). Each row sums to 1. Each call returns a new data.table, so modifying the result by reference leaves x unchanged. A hard clustering, which assigns each case to one cluster with no weights, raises an error.

Examples

Run this code
iris_cm <- cluster(exc(iris, "Species"), algorithm = "CMeans", verbosity = 0L)
get_membership(iris_cm)

Run the code above in your browser using DataLab