-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhnsw_large.go
More file actions
47 lines (38 loc) · 1.07 KB
/
Copy pathhnsw_large.go
File metadata and controls
47 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//go:build ignore
// +build ignore
package main
import (
"os"
"github.com/habedi/hann/core"
"github.com/habedi/hann/example"
"github.com/habedi/hann/hnsw"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
func main() {
// Set the logger to output to the console.
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
// Using HNSW index with GIST and DEEP1B datasets
HNSWIndexGIST("euclidean")
HNSWIndexDEEP1B("cosine")
}
func HNSWIndexGIST(distanceName string) {
factory := func() core.Index {
dimension := 960
M := 16
ef := 100
return hnsw.NewHNSW(dimension, M, ef, core.Distances[distanceName], distanceName)
}
example.RunDataset(factory, "gist-960-euclidean",
"example/data/nearest-neighbors-datasets-large", 100, 5, 5)
}
func HNSWIndexDEEP1B(distanceName string) {
factory := func() core.Index {
dimension := 96
M := 16
ef := 100
return hnsw.NewHNSW(dimension, M, ef, core.Distances[distanceName], distanceName)
}
example.RunDataset(factory, "deep-image-96-angular",
"example/data/nearest-neighbors-datasets-large", 100, 5, 5)
}