wmh

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WeightedMinHasher

type WeightedMinHasher struct {
	// Size of each hash element in bits. Supported values are 16, 32 and 64.
	Bitness int
	// contains filtered or unexported fields
}

WeightedMinHasher calculates Weighted MinHash-es. https://ekzhu.github.io/datasketch/weightedminhash.html

func NewWeightedMinHasher

func NewWeightedMinHasher(dim int, sampleSize int, seed int64) *WeightedMinHasher

NewWeightedMinHasher initializes a new instance of WeightedMinHasher. `dim` is the bag size. `sampleSize` is the hash length. `seed` is the random generator seed, as Weighted MinHash is probabilistic.

func (*WeightedMinHasher) Hash

func (wmh *WeightedMinHasher) Hash(values []float32, indices []int) []uint64

Hash calculates the Weighted MinHash from the weighted bag of features. Each feature has an index and a value.

func (*WeightedMinHasher) MarshalBinary

func (wmh *WeightedMinHasher) MarshalBinary() (data []byte, err error)

MarshalBinary serializes the WeightedMinHasher.

func (*WeightedMinHasher) UnmarshalBinary

func (wmh *WeightedMinHasher) UnmarshalBinary(data []byte) error

UnmarshalBinary reads a WeightedMinHasher previously serialized with MarshalBinary().

Jump to

Keyboard shortcuts

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