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
- type StdDists
- func (i StdDists) Desc() string
- func (i StdDists) Int64() int64
- func (i StdDists) MarshalText() ([]byte, error)
- func (i *StdDists) SetInt64(in int64)
- func (i *StdDists) SetString(s string) error
- func (i StdDists) String() string
- func (i *StdDists) UnmarshalText(text []byte) error
- func (i StdDists) Values() []enums.Enum
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 { // index into original distance matrix -- only valid for for terminal leaves Index int // distance for this node -- how far apart were all the kids from each other when this node was created -- is 0 for leaf nodes Dist float64 // total aggregate distance from parents -- the X axis offset at which our cluster starts ParDist float64 // y-axis value for this node -- if a parent, it is the average of its kids Y's, otherwise it counts down Y float64 // child nodes under this one Kids []*Node }
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 GlomStd ¶
GlomStd 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. Std version uses std distance functions
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.
type StdDists ¶
type StdDists int32 //enums:enum
StdDists are standard clustering distance functions
const ( // Min is the minimum-distance or single-linkage weighting function Min StdDists = iota // Max is the maximum-distance or complete-linkage weighting function Max // Avg is the average-distance or average-linkage weighting function Avg // Contrast computes maxd + (average within distance - average between distance) Contrast )
const StdDistsN StdDists = 4
StdDistsN is the highest valid value for type StdDists, plus one.
func StdDistsValues ¶
func StdDistsValues() []StdDists
StdDistsValues returns all possible values for the type StdDists.
func (StdDists) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*StdDists) SetString ¶
SetString sets the StdDists value from its string representation, and returns an error if the string is invalid.
func (*StdDists) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.