|
4 | 4 | This section is currently being developed. If you're interested in helping write this section, feel free to [open a pull request](https://github.com/kernelmethod/LSHFunctions.jl/pulls); otherwise, please check back later.
|
5 | 5 |
|
6 | 6 | ## LSHFunction
|
7 |
| -The `LSH` module exposes a relatively easy interface for constructing new hash functions. Namely, you call [`LSHFunction`](@ref) with |
| 7 | +The `LSHFunctions` module exposes a relatively easy interface for constructing new hash functions. Namely, you call [`LSHFunction`](@ref) with |
8 | 8 |
|
9 | 9 | - the similarity function you want to use;
|
10 | 10 | - the number of hash functions you want to generate; and
|
@@ -77,48 +77,48 @@ LSHFunctions.jl provides a few common utility functions that you can use across
|
77 | 77 |
|
78 | 78 | - [`n_hashes`](@ref): returns the number of hash functions computed by an [`LSHFunction`](@ref).
|
79 | 79 |
|
80 |
| -```jldoctest; setup = :(using LSHFunctions) |
81 |
| -julia> hashfn = LSHFunction(jaccard); |
| 80 | + ```jldoctest; setup = :(using LSHFunctions) |
| 81 | + julia> hashfn = LSHFunction(jaccard); |
82 | 82 |
|
83 |
| -julia> n_hashes(hashfn) |
84 |
| -1 |
| 83 | + julia> n_hashes(hashfn) |
| 84 | + 1 |
85 | 85 |
|
86 |
| -julia> hashfn = LSHFunction(jaccard, 10); |
| 86 | + julia> hashfn = LSHFunction(jaccard, 10); |
87 | 87 |
|
88 |
| -julia> n_hashes(hashfn) |
89 |
| -10 |
| 88 | + julia> n_hashes(hashfn) |
| 89 | + 10 |
90 | 90 |
|
91 |
| -julia> hashes = hashfn(randn(50)); |
| 91 | + julia> hashes = hashfn(randn(50)); |
92 | 92 |
|
93 |
| -julia> length(hashes) |
94 |
| -10 |
95 |
| -``` |
| 93 | + julia> length(hashes) |
| 94 | + 10 |
| 95 | + ``` |
96 | 96 |
|
97 | 97 | - [`similarity`](@ref): returns the similarity function for which the input [`LSHFunction`](@ref) is locality-sensitive:
|
98 | 98 |
|
99 |
| -```jldoctest; setup = :(using LSHFunctions) |
100 |
| -julia> hashfn = LSHFunction(cossim); |
| 99 | + ```jldoctest; setup = :(using LSHFunctions) |
| 100 | + julia> hashfn = LSHFunction(cossim); |
101 | 101 |
|
102 |
| -julia> similarity(hashfn) |
103 |
| -cossim (generic function with 2 methods) |
104 |
| -``` |
| 102 | + julia> similarity(hashfn) |
| 103 | + cossim (generic function with 2 methods) |
| 104 | + ``` |
105 | 105 |
|
106 | 106 | - [`hashtype`](@ref): returns the type of hash computed by the input hash function. Note that in practice `hashfn(x)` (or [`index_hash(hashfn,x)`](@ref) and [`query_hash(hashfn,x)`](@ref) for an [`AsymmetricLSHFunction`](@ref)) will return an array of hashes, one for each hash function you generated. [`hashtype`](@ref) is the data type of each element of `hashfn(x)`.
|
107 | 107 |
|
108 |
| -```jldoctest; setup = :(using LSHFunctions) |
109 |
| -julia> hashfn = LSHFunction(cossim, 5); |
| 108 | + ```jldoctest; setup = :(using LSHFunctions) |
| 109 | + julia> hashfn = LSHFunction(cossim, 5); |
110 | 110 |
|
111 |
| -julia> hashtype(hashfn) |
112 |
| -Bool |
| 111 | + julia> hashtype(hashfn) |
| 112 | + Bool |
113 | 113 |
|
114 |
| -julia> hashes = hashfn(rand(100)); |
| 114 | + julia> hashes = hashfn(rand(100)); |
115 | 115 |
|
116 |
| -julia> typeof(hashes) |
117 |
| -BitArray{1} |
| 116 | + julia> typeof(hashes) |
| 117 | + BitArray{1} |
118 | 118 |
|
119 |
| -julia> typeof(hashes[1]) == hashtype(hashfn) |
120 |
| -true |
121 |
| -``` |
| 119 | + julia> typeof(hashes[1]) == hashtype(hashfn) |
| 120 | + true |
| 121 | + ``` |
122 | 122 |
|
123 | 123 | - [`collision_probability`](@ref): returns the probability of collision for two inputs with a given similarity. For instance, the probability that a single MinHash hash function causes a collision between inputs `A` and `B` is equal to [`jaccard(A,B)`](@ref jaccard):
|
124 | 124 |
|
|
0 commit comments