Documentation
¶
Index ¶
- Constants
- func DotProduct[T PrecisionType](vecA, vecB []T) float64
- func L2Normalize(vec []float64) []float64
- type Float32Handler
- type Float64Handler
- type Int8Handler
- type Int16Handler
- type LSH
- func (l *LSH) AddVector(id string, vector []float64)
- func (l *LSH) AddVectors(vectors map[string][]float64)
- func (l *LSH) BatchQuery(vectors map[string][]float64, k int) map[string][]string
- func (l *LSH) DisableCache()
- func (l *LSH) EnableCache()
- func (l *LSH) EvaluateLSH(testQueries map[string][]float64, groundTruth map[string][]string, k int) (float64, float64, float64)
- func (l *LSH) LoadFromFile() error
- func (l *LSH) LoadRandomVecs() error
- func (l *LSH) Migrate(numTables, numHashes int) (error, *LSH)
- func (l *LSH) Query(vector []float64, k int) []string
- func (l *LSH) SaveRandomVecs() error
- func (l *LSH) SaveToFile() error
- func (l *LSH) SetFilePath(filePath string)
- func (l *LSH) SetPrecisionHandler(precisionHandler PrecisionHandler)
- type PrecisionHandler
- type PrecisionType
Constants ¶
View Source
const ( PrecisionFloat32 string = "float32" PrecisionFloat64 string = "float64" PrecisionInt8 string = "int8" PrecisionInt16 string = "int16" )
View Source
const ( Int8Scale float64 = 126 Int16Scale float64 = 32766 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Float32Handler ¶
type Float32Handler struct{}
func (*Float32Handler) ConvertVector ¶
func (h *Float32Handler) ConvertVector(vec []float64) interface{}
func (*Float32Handler) DotProduct ¶
func (h *Float32Handler) DotProduct(a, b interface{}) float64
func (*Float32Handler) Type ¶
func (h *Float32Handler) Type() string
type Float64Handler ¶
type Float64Handler struct{}
高精度处理器(float64)
func (*Float64Handler) ConvertVector ¶
func (h *Float64Handler) ConvertVector(vec []float64) interface{}
func (*Float64Handler) DotProduct ¶
func (h *Float64Handler) DotProduct(a, b interface{}) float64
func (*Float64Handler) Type ¶
func (h *Float64Handler) Type() string
type Int8Handler ¶
type Int8Handler struct{}
func (*Int8Handler) ConvertVector ¶
func (h *Int8Handler) ConvertVector(vec []float64) interface{}
func (*Int8Handler) DotProduct ¶
func (h *Int8Handler) DotProduct(a, b interface{}) float64
func (*Int8Handler) Type ¶
func (h *Int8Handler) Type() string
type Int16Handler ¶
type Int16Handler struct{}
func (*Int16Handler) ConvertVector ¶
func (h *Int16Handler) ConvertVector(vec []float64) interface{}
func (*Int16Handler) DotProduct ¶
func (h *Int16Handler) DotProduct(a, b interface{}) float64
func (*Int16Handler) Type ¶
func (h *Int16Handler) Type() string
type LSH ¶
type LSH struct {
// contains filtered or unexported fields
}
LSH 结构体
func NewNoCacheLSH ¶
func (*LSH) BatchQuery ¶
批量查询
func (*LSH) DisableCache ¶
func (l *LSH) DisableCache()
func (*LSH) EnableCache ¶
func (l *LSH) EnableCache()
func (*LSH) EvaluateLSH ¶
func (l *LSH) EvaluateLSH(testQueries map[string][]float64, groundTruth map[string][]string, k int) (float64, float64, float64)
评估 LSH 的召回率和精度
func (*LSH) LoadFromFile ¶
func (*LSH) LoadRandomVecs ¶
func (*LSH) SaveToFile ¶
func (*LSH) SetFilePath ¶
func (*LSH) SetPrecisionHandler ¶
func (l *LSH) SetPrecisionHandler(precisionHandler PrecisionHandler)
type PrecisionHandler ¶
type PrecisionHandler interface {
Type() string
ConvertVector([]float64) interface{}
DotProduct(interface{}, interface{}) float64
}
func NewPrecisionHandler ¶
func NewPrecisionHandler(precision string) PrecisionHandler
Click to show internal directories.
Click to hide internal directories.