Documentation ¶
Index ¶
- func AvgDist(aix, bix []int, ntot int, maxd float64, smat []float64) float64
- func ContrastDist(aix, bix []int, ntot int, maxd float64, smat []float64) float64
- func MaxDist(aix, bix []int, ntot int, maxd float64, smat []float64) float64
- func MinDist(aix, bix []int, ntot int, maxd float64, smat []float64) float64
- func Plot(pt *etable.Table, root *Node, smat *simat.SimMat)
- type DistFunc
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvgDist ¶
AvgDist is the average-distance or average-linkage weighting function for comparing two clusters a and b, given by their list of indexes. ntot is total number of nodes, and smat is the square similarity matrix [ntot x ntot].
func ContrastDist ¶
ContrastDist computes maxd + (average within distance - average between distance) for two clusters a and b, given by their list of indexes. avg between is average distance between all items in a & b versus all outside that. ntot is total number of nodes, and smat is the square similarity matrix [ntot x ntot]. maxd is the maximum distance and is needed to ensure distances are positive.
func MaxDist ¶
MaxDist is the maximum-distance or complete-linkage weighting function for comparing two clusters a and b, given by their list of indexes. ntot is total number of nodes, and smat is the square similarity matrix [ntot x ntot].
func MinDist ¶
MinDist is the minimum-distance or single-linkage weighting function for comparing two clusters a and b, given by their list of indexes. ntot is total number of nodes, and smat is the square similarity matrix [ntot x ntot].
Types ¶
type DistFunc ¶
DistFunc is a clustering distance function that evaluates aggregate distance between nodes, given the indexes of leaves in a and b clusters which are indexs into an ntot x ntot similarity (distance) matrix smat. maxd is the maximum distance value in the smat, which is needed by the ContrastDist function and perhaps others.
type Node ¶
type Node struct { Idx int `desc:"index into original distance matrix -- only valid for for terminal leaves"` Dist float64 `` /* 130-byte string literal not displayed */ ParDist float64 `desc:"total aggregate distance from parents -- the X axis offset at which our cluster starts"` Y float64 `desc:"y-axis value for this node -- if a parent, it is the average of its kids Y's, otherwise it counts down"` Kids []*Node `desc:"child nodes under this one"` }
Node is one node in the cluster
func Glom ¶
Glom implements basic agglomerative clustering, based on a raw similarity matrix as given. This calls GlomInit to initialize the root node with all of the leaves, and the calls GlomClust to do the iterative clustering process. If you want to start with pre-defined initial clusters, then call GlomClust with a root node so-initialized. The smat.Mat matrix must be an etensor.Float64.
func GlomClust ¶
GlomClust does the iterative agglomerative clustering, based on a raw similarity matrix as given, using a root node that has already been initialized with the starting clusters (all of the leaves by default, but could be anything if you want to start with predefined clusters). The smat.Mat matrix must be an etensor.Float64.
func (*Node) Plot ¶
Plot sets the rows of given data table to trace out lines with labels that will render this node in a cluster plot when plotted with a standard plotting package. The lines double-back on themselves to form a continuous line to be plotted.
func (*Node) SetParDist ¶
SetParDist sets the parent distance for the nodes in preparation for plotting.