Skip to content

Cogile/simhash-lsh

 
 

Repository files navigation

simhash-lsh

Cosine/Simhash locality sensitive hashing (LSH) in Golang with Euclidean distance sort

Implements Random projection LSH https://en.wikipedia.org/wiki/Locality-sensitive_hashing#Random_projection

Build Status Go Report Card GoDoc

Usage

Use go tool to install the package in your packages tree:

go get github.com/cogile/simhash-lsh

Import package as:

import "github.com/cogile/simhash-lsh"

Basic example

func main() {
	lsh := simhashlsh.NewCosineLsh(8, 1, 6)
	lsh.Insert([]float64{1, 2, 3, 4, 5, 6, 7, 8}, "1")
	lsh.Insert([]float64{2, 3, 4, 5, 6, 7, 8, 9}, "2")
	lsh.Insert([]float64{10, 12, 99, 1, 5, 31, 2, 3}, "3")
	fmt.Println(lsh.Query([]float64{1, 2, 3, 4, 5, 6, 7, 7}))
	// [{[1 2 3 4 5 6 7 8] 1} {[2 3 4 5 6 7 8 9] 2}]
}

About

Cosine LSH in Golang

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 100.0%