simat

package
v1.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2020 License: BSD-3-Clause Imports: 4 Imported by: 33

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

func BlankRepeat(str []string) []string

BlankRepeat returns string slice with any sequentially repeated strings blanked out

func Tensor

func Tensor(smat etensor.Tensor, a etensor.Tensor, mfun metric.Func64) error

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

func TensorStd(smat etensor.Tensor, a etensor.Tensor, met metric.StdMetrics) error

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

func Tensors(smat etensor.Tensor, a, b etensor.Tensor, mfun metric.Func64) error

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

func TensorsStd(smat etensor.Tensor, a, b etensor.Tensor, met metric.StdMetrics) error

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 {
	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.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL