metric

package
v0.0.0-...-7932e50 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric interface {
	// CalcDistance ... calculates the distance between given vectors
	CalcDistance(v1, v2 []float64) float64
	// GetSplittingVector ... calculates the splitting vector which becomes a node's vector in the index
	GetSplittingVector(vs [][]float64) []float64
	// CalcDirectionPriority ... calculates the priority of the children nodes which can be used for determining
	// which way (right or left child) should go next traversal. The return values must be contained in [-1, 1].
	CalcDirectionPriority(base, target []float64) float64
}

Metric is the interface of metrics which defines target search spaces.

func NewCosineMetric

func NewCosineMetric(dim int) (Metric, error)

NewCosineMetric returns cosineDistance. NOTE: We assume that the given vectors are already normalized, i.e. the norm equals 1

Jump to

Keyboard shortcuts

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