Hey there! I got a pseudo code and don't know how to apply it to R, maybe someone can help me: Input: A dataset X, kmax: maximum number of clusters, num_subsamples: number of subsamples. Output: S(i; k) - a distribution of similarities between partitions into k clusters of a reference clustering and clustering of subsamples; i = 1 to num_subsamples Requires: T = cluster(X): A hierarchical clustering algorithm L = cut-tree(T; k): produces a partition with k non-singleton clusters s(L1;L2): a similarity between two partitions 1: f = 0:8 2: T =cluster(X) fthe reference clustering 3: for i = 1 to num subsamples do 4: subi =subsamp(X; f) fsub-sample a fraction f of the datag 5: Ti=cluster(subi) 6: end for 7: for k = 2 to kmax do 8: L1=cut-tree(T; k) fpartition the reference clusteringg 9: for i = 1 to maximum iterations do 10: L2 =cut-tree(Ti; k) 11: S(i; k) = s(L2;L1) computed only on the patterns of subi. 12: end for 13: end for I am glad about any help, don't really know what to do! thanks, regards Julia --
> Requires: T = cluster(X): A hierarchical clustering algorithm > L = cut-tree(T; k): produces a partition with k non-singleton clustersThe functions you'll want to read the documentation to, here, are "hclust()" and "cutree()". They're fairly straightforward and nicely documented. It looks like you are running cutree at multiple heights of the hclust object to get different numbers of clusters; am I interpreting that correctly? --elijah> s(L1;L2): a similarity between two partitions > > 1: f = 0:8 > 2: T =cluster(X) fthe reference clustering > 3: for i = 1 to num subsamples do > 4: subi =subsamp(X; f) fsub-sample a fraction f of the datag > 5: Ti=cluster(subi) > 6: end for > 7: for k = 2 to kmax do > 8: L1=cut-tree(T; k) fpartition the reference clusteringg > 9: for i = 1 to maximum iterations do > 10: L2 =cut-tree(Ti; k) > 11: S(i; k) = s(L2;L1) computed only on the patterns of subi. > 12: end for > 13: end for > > I am glad about any help, don't really know what to do! > thanks, regards > Julia > -- > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Seemingly Similar Threads
- [Bug 377] New: Reduce compiler warnings. Use unsigned args to the ctype.h is*() macros.
- Instruction itineraries and fence/barrier instructions
- Instruction itineraries and fence/barrier instructions
- efficiency and "forcing" questions
- [PATCH v3 02/22] common/mlpcre: Add PCRE.subi to return indexes instead of the substring.