| trajClusters | R Documentation |
Classifies the trajectories by applying a nonparametric clustering algorithm to the measures computed by trajMeasures().
trajClusters(
Measures,
select = NULL,
fuzzy = FALSE,
nclusters = NULL,
subset.n = NULL,
nstart = 50
)
## S3 method for class 'trajClusters'
print(x, ...)
## S3 method for class 'trajClusters'
summary(object, top_p = 3, ...)
Measures |
object of class |
select |
an optional vector of positive integers corresponding to the
measures to use in the clustering. Defaults to |
fuzzy |
logical. If FALSE, each trajectory is assigned to a unique group. If TRUE, each trajectory is assigned a "degree of membership" to each group. Defaults to FALSE. |
nclusters |
The desired number of clusters. If |
subset.n |
A positive numerical integer smaller than the number of trajectories. If |
nstart |
The number of random starts. Defaults to |
x |
object of class |
... |
further arguments passed to or from other methods. |
object |
object of class |
top_p |
The |
The spectral clustering algorithm presented in Meila (2005) is implemented in which the similarity matrix S is built from a binary K nearest neighbors similarity function (S=(W+W^T)/2, where W_{ij}=1 if data point j is among the nearest points to data point i and W_{ij}=0 otherwise).
When nclusters = NULL, the function evaluates candidate clusterings with number of clusters k ranging from 2 to 8 using three internal validity indices: C-index, Calinski-Harabasz and Wemmert-Gançarski. These indices are normalized so that the highest value is 1 and the lowest is 0, and so that a high value is synonymous with high validity. The optimal number of clusters is determined according to a ranked voting system in which each index contributes a fractional vote according to its ranking of the candidate solutions. Specifically, each index casts a vote worth 1 in favor of k if it takes its greatest value when the number of groups is k, worth 5/6 if it takes its second greatest value when the number of groups is k, and so on down to a vote worth 0 if the index takes its smallest value when the number of groups is k. The favorability of k is the sum of the 3 votes.
An object of class trajClusters; a list containing the result of the clustering, as well as a curated form of the arguments.
Meila, M., Spectral Clustering. Handbook of Cluster Analysis, Chapter 7, Chapman and Hall/CRC, 2005.
## Not run:
data("trajdata")
trajdata.noGrp <- trajdata[, -which(colnames(trajdata) == "Group")] # remove the Group column
m = trajMeasures(trajdata.noGrp, ID = TRUE, measures = 1:20)
s2.3 <- trajClusters(m, nclusters = 3)
plot(s2.3)
s2.4 <- trajClusters(m, nclusters = 4)
plot(s2.4)
s2.5 <- trajClusters(m, nclusters = 5)
plot(s2.5)
groups <- trajClusters(m, nclusters = 4)$partition
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.