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 ¶
- func BlankRepeat(str []string) []string
- func Tensor(smat etensor.Tensor, a etensor.Tensor, mfun metric.Func64) error
- func TensorStd(smat etensor.Tensor, a etensor.Tensor, met metric.StdMetrics) error
- func Tensors(smat etensor.Tensor, a, b etensor.Tensor, mfun metric.Func64) error
- func TensorsStd(smat etensor.Tensor, a, b etensor.Tensor, met metric.StdMetrics) error
- type SimMat
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 TensorStd ¶ added in v1.0.16
TensorStd computes a similarity / distance matrix on tensor using given Std 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). This Std version is usable e.g., in Python where the func cannot be passed.
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
func TensorsStd ¶ added in v1.0.16
TensorsStd computes a similarity / distance matrix on two tensors using given Std 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 This Std version is usable e.g., in Python where the func cannot be passed.
Types ¶
type SimMat ¶
type SimMat struct { // the similarity / distance matrix (typically an etensor.Float64) Mat etensor.Tensor `desc:"the similarity / distance matrix (typically an etensor.Float64)"` // labels for the rows -- blank rows trigger generation of grouping lines Rows []string `desc:"labels for the rows -- blank rows trigger generation of grouping lines"` // labels for the columns -- blank columns 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.
func (*SimMat) TableColStd ¶ added in v1.0.14
func (smat *SimMat) TableColStd(ix *etable.IdxView, colNm, labNm string, blankRepeat bool, met metric.StdMetrics) error
TableColStd generates a similarity / distance matrix from given column name in given IdxView of an etable.Table, and given standard 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. This Std version is usable e.g., in Python where the func cannot be passed.