Documentation ¶
Overview ¶
Package simat provides similarity / distance matrix functions that create a SimMat matrix from Tensor or Table data. Any metric function defined in metric package (or user-created) can be used.
The SimMat contains the Tensor of the similarity matrix values, and labels for the Rows and Columns.
The etview package provides a SimMatGrid widget that displays the SimMat with the labels.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlankRepeat ¶
BlankRepeat returns string slice with any sequentially repeated strings blanked out
func Tensor ¶
Tensor computes a similarity / distance matrix on tensor using given metric function. Outer-most dimension ("rows") is used as "indexical" dimension and all other dimensions within that are compared. Results go in smat which is ensured to have proper square 2D shape (rows * rows).
func Tensors ¶
Tensors computes a similarity / distance matrix on two tensors using given metric function. Outer-most dimension ("rows") is used as "indexical" dimension and all other dimensions within that are compared. Resulting reduced 2D shape of two tensors must be the same (returns error if not). Rows of smat = a, cols = b
Types ¶
type SimMat ¶
type SimMat struct { Mat etensor.Tensor `desc:"the similarity / distance matrix (typically an etensor.Float64)"` Rows []string `desc:"labels for the rows -- blank rows trigger generation of grouping lines"` Cols []string `desc:"labels for the columns -- blank columns trigger generation of grouping lines"` }
SimMat is a similarity / distance matrix with additional row and column labels for display purposes.
func (*SimMat) Init ¶
func (smat *SimMat) Init()
Init initializes SimMat with default Matrix and nil rows, cols
func (*SimMat) TableCol ¶
func (smat *SimMat) TableCol(ix *etable.IdxView, colNm, labNm string, blankRepeat bool, mfun metric.Func64) error
TableCol generates a similarity / distance matrix from given column name in given IdxView of an etable.Table, and given metric function. if labNm is not empty, uses given column name for labels, which if blankRepeat is true are filtered so that any sequentially repeated labels are blank.