Documentation ¶
Index ¶
- type CosineLabeledMatrix
- type CosineMatrix
- type LabelMap
- type LabeledMatrix
- type LabeledVector
- func (v *LabeledVector) Append(index int, value float64)
- func (v *LabeledVector) AppendVector(vector mat.Vector)
- func (v LabeledVector) HeadLabeles(length int) []int
- func (v LabeledVector) HeadValues(length int) []float64
- func (v LabeledVector) Len() int
- func (v LabeledVector) Less(i, j int) bool
- func (v LabeledVector) Swap(i, j int)
- func (v LabeledVector) Visit(do func(index int, value float64))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CosineLabeledMatrix ¶
CosineLabeledMatrix is a CosineMatrix including a label -> row/col index mapping
func NewCosineLabeledMatrix ¶
func NewCosineLabeledMatrix(matrix *LabeledMatrix) *CosineLabeledMatrix
NewCosineLabeledMatrix creates a new indexed cosine similarity matrix of size col x col
func (*CosineLabeledMatrix) Width ¶
func (matrix *CosineLabeledMatrix) Width() int
Width returns the width of the matrix (matrix is size width x width)
type CosineMatrix ¶
CosineMatrix is an item x item matrix where the cells contain the cosine similarity between the two items
func NewCosineMatrix ¶
func NewCosineMatrix(matrix *mat.Dense) *CosineMatrix
NewCosineMatrix creates a new cosine similarity matrix of size col x col
type LabelMap ¶
type LabelMap []string
LabelMap is a slice of strings
func (*LabelMap) FilterVector ¶
FilterVector creates a new LabelMap only returning items at vector
type LabeledMatrix ¶
LabeledMatrix is a dense matrix where columns and rows are indexed using label -> index mapping
func LabelMatrixFromCSV ¶
func LabelMatrixFromCSV(r io.Reader) *LabeledMatrix
LabelMatrixFromCSV creates a new LabeledMatrix from a CSV file The file needs to contain both a header and a first column containing unique labels
func NewLabeledMatrix ¶
func NewLabeledMatrix(data []float64, columnLabel LabelMap, rowLabel LabelMap) *LabeledMatrix
NewLabeledMatrix creates a new Dense labeled matrix
type LabeledVector ¶
type LabeledVector []*vectorItem
LabeledVector is a vector that keeps a reference from each value to it's original index. Common usecase is to sort the vector and get get all top indexes
func NewLabelVector ¶
func NewLabelVector() LabeledVector
NewLabelVector creates an empty indexed vector.
func (*LabeledVector) Append ¶
func (v *LabeledVector) Append(index int, value float64)
Append adds a single entry in the vector with index, value
func (*LabeledVector) AppendVector ¶
func (v *LabeledVector) AppendVector(vector mat.Vector)
AppendVector appends all non zero items to this vector
func (LabeledVector) HeadLabeles ¶
func (v LabeledVector) HeadLabeles(length int) []int
HeadLabeles return length indexes, 0 returns all
func (LabeledVector) HeadValues ¶
func (v LabeledVector) HeadValues(length int) []float64
HeadValues return length values, 0 returns all
func (LabeledVector) Len ¶
func (v LabeledVector) Len() int
func (LabeledVector) Less ¶
func (v LabeledVector) Less(i, j int) bool
func (LabeledVector) Swap ¶
func (v LabeledVector) Swap(i, j int)
func (LabeledVector) Visit ¶
func (v LabeledVector) Visit(do func(index int, value float64))
Visit each entry in the vector with a callback