[R] pseudo code

"Julia Kröpfl" jkroepfl at gmx.net
Tue Oct 9 12:26:36 CEST 2007

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

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

More information about the R-help mailing list