%DeepSee.extensions.clusters.Ordered
Class %DeepSee.extensions.clusters.Ordered Extends %RegisteredObject [ System = 4 ]
This class provides cluster analysis for a set of ordered objects. One can also think of it as one-dimensional cluster analysis.
Methods in this class divide the set into a given number of subsets trying to optimize a given target value. Target value can be:
- Cost, i.e. the sum of the sum of squared deviations from the mean-value within each cluster
- Correlation between clusters (regions) and entities
- Loss of information caused by using a region as a hole instead of every entity in the region
Methods
ordered
ClassMethod ordered(m As %Integer, ByRef key, nc As %Integer, Output q) As %Status
This method clusters one-dimensional ordered data into nc clusters.
The algorithm is described in:
Helmuth Spaeth,
Cluster Analysis Algorithms for Data Reduction and Classification of Objects,
Ellis Horwood, 1980, page 63, QA278 S6813.
Input data is given as a multidimensional array m. The top value of m must be the number of data objects in the array. The array contains numerical values m(1:m) for each object.
In most cases key should be an empty string. In such a case all calculations are done in memory. If key has value then this value is used as a subscript ot a process private globals that hold intermediate results. This will make the calculations significantly slower but will allow to deal with larger amount of objects.
The result is returned in teh form of multi-dimensional array q. q(1:nc,1:nc), describes the clusters of data. The last row of q stores the first element in each cluster. Thus cluster 1 contains data items q(nc,1) through q(nc,2)-1. Other information is contained in previous rows. In particular, in row J, columns 1 through J, there is similar information about a partition involving J clusters.
test1
ClassMethod test1(nc As %Integer = 4, n As %Integer = 10, useGlobals As %Boolean = 0) [ Internal ]
test2
ClassMethod test2(nc As %Integer = 4, n As %Integer = 10) [ Internal ]
test3
ClassMethod test3(nc As %Integer = 4, n As %Integer = 10) [ Internal ]
print
ClassMethod print(m As %Integer, nc As %Integer, ByRef key, ByRef q)
This method prints verbose information about clustering results obtained by method ordered. Input data is taken in the same way as by ordered method.
pg
ClassMethod pg(m As %Integer, nc As %Integer, ByRef key, ByRef q, ByRef sc As %Status) As %Double
This method calculates Pearson-Gamma correlation coefficent for clustering obtained by method ordered. Input data is taken in the same way as by ordered method.
For more information about Pearson-Gamma correlation coefficent see PearsonGamma