lsh

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDocument    = errors.New("vector length does not match with the configured options")
	ErrNoOptions          = errors.New("no options set for LSH")
	ErrNoVectorComplexity = errors.New("vector does not have enough complexity with a standard deviation of 0")
)

Functions

This section is empty.

Types

type LSH

type LSH struct {
	Cfg    *configs.LSHConfigs
	Tables []*tables.Table        // N tables each using a different randomly generated set of hyperplanes
	Docs   *forwardindex.InMemory // forward index which may be offloaded to a separate system
}

LSH represents the locality sensitive hash struct that stores the multiple tables containing the configured number of hyperplanes along with the documents currently indexed.

func New

func New(cfg *configs.LSHConfigs) (*LSH, error)

New returns a new Locality Sensitive Hash struct ready for indexing and searching

func (*LSH) Delete

func (l *LSH) Delete(uid uint64) error

Delete attempts to remove the uid from the tables and also the document map

func (*LSH) Index

func (l *LSH) Index(d document.Document) error

Index stores the document in the LSH data structure. Returns an error if the document is already present.

func (*LSH) Search

func (l *LSH) Search(d document.Document, s *options.Search) (results.Scores, int, error)

Search looks through and merges results from all tables to find the nearest neighbors to the provided vector

func (*LSH) Stats

func (l *LSH) Stats() *stats.Statistics

Stats returns the current statistics about the configured LSH struct.

Jump to

Keyboard shortcuts

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