Skip to content

Commit e3b2e56

Browse files
committed
Update docs.
1 parent e72794c commit e3b2e56

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ makedocs(
1313
modules = [LSHFunctions],
1414
pages = ["Home" => "index.md",
1515
"The LSHFunction API" => "lshfunction_api.md",
16-
"Similarity functions" => [
16+
"Similarity statistics" => [
1717
"Cosine similarity" => joinpath("similarities", "cosine.md"),
1818
"``\\ell^p`` distance" => joinpath("similarities", "lp_distance.md"),
1919
"Jaccard similarity" => joinpath("similarities", "jaccard.md"),

docs/src/lshfunction_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## LSHFunction
77
The `LSHFunctions` module exposes a relatively easy interface for constructing new hash functions. Namely, you call [`LSHFunction`](@ref) with
88

9-
- the similarity function you want to use;
9+
- the similarity statistic you want to hash on;
1010
- the number of hash functions you want to generate; and
1111
- keyword parameters specific to the LSH function family that you're sampling from.
1212

src/LSHBase.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,19 @@ Compute the probability of hash collision between two inputs with similarity `si
6868
- `sim`: a similarity (or vector of similarities), computed using the similarity function returned by `similarity(hashfn)`.
6969
7070
# Keyword arguments
71-
- `n_hashes::Union{Symbol,Integer}` (default: `:auto`): the number of hash functions to use to compute the probability of collision. If the probability that a single hash collides is ``p``, then the probability that `n_hashes` hashes simultaneously collide is
71+
- `n_hashes::Union{Symbol,Integer}` (default: `:auto`): the number of hash functions to use to compute the probability of collision. If the probability that a single hash collides is `p`, then the probability that `n_hashes` hashes simultaneously collide is `p^n_hashes`. As a result,
7272
73-
```math
74-
p^{\\text{n_hashes}}
73+
```
74+
collision_probability(hashfn, sim; n_hashes=N)
75+
```
76+
77+
is the same as
78+
79+
```
80+
collision_probability(hashfn, sim; n_hashes=1).^N
7581
```
7682
77-
As a result, `collision_probability(hashfn, sim; n_hashes=N)` is the same as `collision_probability(hashfn, sim; n_hashes=1).^N`. If `n_hashes = :auto` then this function will select the number of hashes to be `n_hashes(hashfn)` (using the [`n_hashes`](@ref) function from the [`LSHFunction`](@ref) API).
83+
If `n_hashes = :auto` then this function will select the number of hashes to be `n_hashes(hashfn)` (using the [`n_hashes`](@ref) function from the [`LSHFunction`](@ref) API).
7884
7985
# Examples
8086
The probability that a single MinHash hash function causes a hash collision between inputs `A` and `B` is equal to `jaccard(A,B)`:

src/function_hashing/monte_carlo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ join(
8080
Given an input function ``f\\in L^p_{\\mu}(\\Omega)``, `MonteCarloHash` works by sampling ``f`` at some randomly-selected points in ``\\Omega``, and then hashing those samples.
8181
8282
# Arguments
83-
- `sim`: the similarity function you want to hash on.
83+
- `sim`: the similarity statistic you want to hash on.
8484
- `ω`: a function that takes no inputs and samples a single point from ``\\Omega``. Alternatively, it can be viewed as a random variable with probability measure
8585
8686
```math
87-
\\frac{\\mu}{\\text{vol}_{\\mu}(\\Omega)} = \\mu\\left(\\int_{\\Omega} d\\mu\\right)^{-1}
87+
\\frac{\\mu}{\\text{vol}_{\\mu}(\\Omega)} = \\frac{\\mu}{\\int_{\\Omega} d\\mu}
8888
```
8989
9090
- `args...`: arguments to pass on when building the `LSHFunction` instance underlying the returned `MonteCarloHash` struct.

0 commit comments

Comments
 (0)