index

package
v0.0.0-...-93ee6ed Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Binary search tree

Implementation of Parallel K-Means++

Index

Constants

View Source
const (
	HnswSearchSimple hnswSearchAlgorithm = iota
	HnswSearchHeuristic
)

Variables

This section is empty.

Functions

func NewBtreeIndex

func NewBtreeIndex(size int, space math.Space, options ...BtreeOption) *btreeIndex

bTree index builds a forest of randomized binary search trees. Every node uniformly samples a pair of points and using a hyperplane equidistant to these two points splits space based on signed point plane distance. Once there is <= maxLeafItems in a node, it's considered to be a leaf node.

func NewHnswIndex

func NewHnswIndex(size int, space math.Space, options ...HnswOption) *hnswIndex

func NewVoronoiIndex

func NewVoronoiIndex(size int, space math.Space, options ...VoronoiOption) *voronoiIndex

Voronoi index builds a tree using kMeans algorithm. Every node of this tree (except leaf nodes) has number of children determined by splitFactor argument. Once there is <= maxCellItems in a node, it's considered to be a leaf node.

Types

type BtreeOption

type BtreeOption interface {
	// contains filtered or unexported methods
}

func BtreeMaxLeafItems

func BtreeMaxLeafItems(value int) BtreeOption

func BtreeNumTrees

func BtreeNumTrees(value int) BtreeOption

type HnswOption

type HnswOption interface {
	// contains filtered or unexported methods
}

Options

func HnswEf

func HnswEf(value int) HnswOption

func HnswEfConstruction

func HnswEfConstruction(value int) HnswOption

func HnswLevelMultiplier

func HnswLevelMultiplier(value float32) HnswOption

func HnswM

func HnswM(value int) HnswOption

func HnswMmax

func HnswMmax(value int) HnswOption

func HnswMmax0

func HnswMmax0(value int) HnswOption

func HnswSearchAlgorithm

func HnswSearchAlgorithm(value hnswSearchAlgorithm) HnswOption

type Index

type Index interface {
	Build(context.Context)
	Search(context.Context, int, math.Vector) SearchResult
	ByteSize() int
	Len() int
	Size() int
	Reset()
	Items() map[int64]math.Vector
	Add(int64, math.Vector) error
	Get(int64) math.Vector
	Load(io.Reader) error
	Save(io.Writer) error
	ToProto() *pb.Index
}

func FromProto

func FromProto(proto *pb.Index) Index

type SearchResult

type SearchResult []*pb.SearchResultItem

func (SearchResult) Len

func (r SearchResult) Len() int

func (SearchResult) Less

func (r SearchResult) Less(i, j int) bool

func (SearchResult) Swap

func (r SearchResult) Swap(i, j int)

type VoronoiOption

type VoronoiOption interface {
	// contains filtered or unexported methods
}

func VoronoiMaxCellItems

func VoronoiMaxCellItems(value int) VoronoiOption

func VoronoiSplitFactor

func VoronoiSplitFactor(value int) VoronoiOption

Jump to

Keyboard shortcuts

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