annbench

package
v0.0.0-...-c6ab6ab Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Tol = 1e-6
)

Variables

This section is empty.

Functions

func DistanceBasedPrecisionRecall

func DistanceBasedPrecisionRecall(predIdxs, gtIdxs []int, prediction []lsh.Neighbor, groundTruth []float64, epsilon float64) (float64, float64)

DistanceBasedPrecisionRecall https://arxiv.org/pdf/1807.05614.pdf

func GetFloat64Range

func GetFloat64Range(data [][]float64) (float64, float64)

func GetVectorsFromHDF5

func GetVectorsFromHDF5(table *hdf5.File, datasetName string, vecs interface{}) error

GetVectorsFromHDF5 returns slice of feature vectors, from the hdf5 table Objects inside the hdf5: train test distances neighbors

func PrecisionRecall

func PrecisionRecall(prediction, groundTruth []int) (float64, float64)

Recall returns ratio of relevant predictions over the all true relevant items

Types

type BenchData

type BenchData struct {
	TrainVecs    [][]float64
	TrainNorms   map[int]float64
	TrainIds     []string
	Test         [][]float64
	TrainIndices map[string]int
	Neighbors    [][]int
	Distances    [][]float64
	Mean         []float64
	Std          []float64
}

func PrepHdf5BenchDataset

func PrepHdf5BenchDataset(config *BenchDataConfig) (*BenchData, error)

type BenchDataConfig

type BenchDataConfig struct {
	DatasetPath  string
	SampleSize   int
	TrainDim     int
	NeighborsDim int
}

type NNMock

type NNMock struct {
	MaxCandidates int
	// contains filtered or unexported fields
}

func NewNNMock

func NewNNMock(maxCandidates int, store store.Store, metric lsh.Metric) *NNMock

func (*NNMock) Search

func (nn *NNMock) Search(query []float64, maxNN int, distanceThrsh float64) ([]lsh.Neighbor, error)

func (*NNMock) Train

func (nn *NNMock) Train(vecs [][]float64, ids []string) error

type Prediction

type Prediction struct {
	Neighbors []lsh.Neighbor
	Idx       int
}

type SearchConfig

type SearchConfig struct {
	Metric        lsh.Metric
	MaxDist       float64
	NDims         int
	KMinVecs      int
	NTrees        int
	MaxNN         int
	Epsilon       float64
	MaxCandidates int
	BatchSize     int
}

Jump to

Keyboard shortcuts

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