Documentation
¶
Index ¶
- func Hash64(s string) uint64
- func MinInt(a, b int) int
- type HashFunc
- type LSHIndex
- func (idx *LSHIndex) AddFragment(id string, signature *MinHashSignature) error
- func (idx *LSHIndex) Bands() int
- func (idx *LSHIndex) BuildIndex() error
- func (idx *LSHIndex) FindCandidates(signature *MinHashSignature) []string
- func (idx *LSHIndex) GetSignature(id string) *MinHashSignature
- func (idx *LSHIndex) Rows() int
- func (idx *LSHIndex) Size() int
- type MinHashSignature
- type MinHasher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LSHIndex ¶
type LSHIndex struct {
// contains filtered or unexported fields
}
LSHIndex implements MinHash LSH with banding.
func NewLSHIndex ¶
NewLSHIndex creates an index with banding parameters.
func (*LSHIndex) AddFragment ¶
func (idx *LSHIndex) AddFragment(id string, signature *MinHashSignature) error
AddFragment inserts a fragment signature into the index.
func (*LSHIndex) BuildIndex ¶
BuildIndex is a no-op for incremental building (kept for API symmetry).
func (*LSHIndex) FindCandidates ¶
func (idx *LSHIndex) FindCandidates(signature *MinHashSignature) []string
FindCandidates retrieves candidate fragment IDs that share at least one band bucket.
func (*LSHIndex) GetSignature ¶
func (idx *LSHIndex) GetSignature(id string) *MinHashSignature
GetSignature returns the stored signature for a fragment ID.
type MinHashSignature ¶
type MinHashSignature struct {
// contains filtered or unexported fields
}
MinHashSignature holds the signature vector.
func (*MinHashSignature) NumHashes ¶
func (s *MinHashSignature) NumHashes() int
NumHashes returns the number of hash functions used.
func (*MinHashSignature) Signatures ¶
func (s *MinHashSignature) Signatures() []uint64
Signatures returns the signature slice.
type MinHasher ¶
type MinHasher struct {
// contains filtered or unexported fields
}
MinHasher computes MinHash signatures for feature sets.
func NewMinHasher ¶
NewMinHasher creates a MinHasher with numHashes functions (default 128 if invalid).
func (*MinHasher) ComputeSignature ¶
func (m *MinHasher) ComputeSignature(features []string) *MinHashSignature
ComputeSignature computes the MinHash signature for a set of features.
func (*MinHasher) EstimateJaccardSimilarity ¶
func (m *MinHasher) EstimateJaccardSimilarity(sig1, sig2 *MinHashSignature) float64
EstimateJaccardSimilarity estimates Jaccard similarity via signature agreement ratio.