diff --git a/.travis.yml b/.travis.yml index 142b791..6f88882 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,13 @@ language: julia +# Cache artifacts between tests: +# +# http://discourse.julialang.org/t/recommendation-cache-julia-artifacts-in-ci-services/ +# +cache: + directories: + - $HOME/.julia/artifacts + os: linux dist: bionic @@ -28,6 +36,9 @@ jobs: - julia -e 'using Coverage; Coveralls.submit(Coveralls.process_folder());' - julia -e 'using Coverage; Codecov.submit(Codecov.process_folder());' + - stage: + julia: 1.5 + - stage: julia: nightly diff --git a/Manifest.toml b/Manifest.toml index c587f6b..5bf4f88 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -28,15 +28,15 @@ uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" version = "0.3.3+0" [[DataAPI]] -git-tree-sha1 = "00612b2fbe534a539dc7f70106c71e3a943d9b98" +git-tree-sha1 = "176e23402d80e7743fc26c19c681bfb11246af32" uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.2.0" +version = "1.3.0" [[DataStructures]] deps = ["InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "9faa13be79557bf4c5713fb912b0e3c5aa33d046" +git-tree-sha1 = "edad9434967fdc0a2631a65d902228400642120c" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.17.13" +version = "0.17.19" [[Dates]] deps = ["Printf"] @@ -48,27 +48,27 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[Distributions]] deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns"] -git-tree-sha1 = "c4ed10355637fcb0725dc6a27060f74df24f13cd" +git-tree-sha1 = "78c4c32a2357a00a0a7d614880f02c2c6e1ec73c" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" -version = "0.23.2" +version = "0.23.4" [[DocStringExtensions]] deps = ["LibGit2", "Markdown", "Pkg", "Test"] -git-tree-sha1 = "88bb0edb352b16608036faadcc071adda068582a" +git-tree-sha1 = "c5714d9bcdba66389612dc4c47ed827c64112997" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.8.1" +version = "0.8.2" [[Documenter]] deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"] -git-tree-sha1 = "bc99c157ff2957c058a1067061d16c2c83d1ec42" +git-tree-sha1 = "f3464968c65fc78846dad1c038c474a2c39bbb23" uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -version = "0.24.9" +version = "0.25.0" [[FFTW]] deps = ["AbstractFFTs", "FFTW_jll", "IntelOpenMP_jll", "Libdl", "LinearAlgebra", "MKL_jll", "Reexport"] -git-tree-sha1 = "109d82fa4b00429f9afcce873e9f746f11f018d3" +git-tree-sha1 = "14536c95939aadcee44014728a459d2fe3ca9acf" uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -version = "1.2.0" +version = "1.2.2" [[FFTW_jll]] deps = ["Libdl", "Pkg"] @@ -78,9 +78,9 @@ version = "3.3.9+5" [[FillArrays]] deps = ["LinearAlgebra", "Random", "SparseArrays"] -git-tree-sha1 = "51cc2f9bc4eb9c6c0e81ec2f779d1085583cc956" +git-tree-sha1 = "bf726ba7ce99e00d10bf63c031285fb9ab3676ae" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" -version = "0.8.7" +version = "0.8.11" [[IntelOpenMP_jll]] deps = ["Libdl", "Pkg"] @@ -114,9 +114,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" [[MKL_jll]] deps = ["IntelOpenMP_jll", "Libdl", "Pkg"] -git-tree-sha1 = "720629cc8cbd12c146ca01b661fd1a6cf66e2ff4" +git-tree-sha1 = "0ce9a7fa68c70cf83c49d05d2c04d91b47404b08" uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7" -version = "2019.0.117+2" +version = "2020.1.216+0" [[Markdown]] deps = ["Base64"] @@ -133,9 +133,9 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[OpenBLAS_jll]] deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"] -git-tree-sha1 = "2ee3e636e94b9fd95fa8364d5cba2e20dae16609" +git-tree-sha1 = "1887096f6897306a4662f7c5af936da7d5d1a062" uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.9+2" +version = "0.3.9+4" [[OpenSpecFun_jll]] deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"] @@ -144,10 +144,9 @@ uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" version = "0.5.3+3" [[OrderedCollections]] -deps = ["Random", "Serialization", "Test"] -git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1" +git-tree-sha1 = "12ce190210d278e12644bcadf5b21cbdcf225cd3" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.1.0" +version = "1.2.0" [[PDMats]] deps = ["Arpack", "LinearAlgebra", "SparseArrays", "SuiteSparse", "Test"] @@ -157,9 +156,9 @@ version = "0.9.12" [[Parsers]] deps = ["Dates", "Test"] -git-tree-sha1 = "f8f5d2d4b4b07342e5811d2b6428e45524e241df" +git-tree-sha1 = "20ef902ea02f7000756a4bc19f7b9c24867c6211" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "1.0.2" +version = "1.0.6" [[Pkg]] deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] @@ -197,9 +196,9 @@ version = "0.6.1" [[Rmath_jll]] deps = ["Libdl", "Pkg"] -git-tree-sha1 = "1660f8fefbf5ab9c67560513131d4e933012fc4b" +git-tree-sha1 = "d76185aa1f421306dec73c057aa384bad74188f0" uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" -version = "0.2.2+0" +version = "0.2.2+1" [[SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" @@ -222,9 +221,9 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[SpecialFunctions]] deps = ["OpenSpecFun_jll"] -git-tree-sha1 = "e19b98acb182567bcb7b75bb5d9eedf3a3b5ec6c" +git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "0.10.0" +version = "0.10.3" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] @@ -238,9 +237,9 @@ version = "0.33.0" [[StatsFuns]] deps = ["Rmath", "SpecialFunctions"] -git-tree-sha1 = "f290ddd5fdedeadd10e961eb3f4d3340f09d030a" +git-tree-sha1 = "04a5a8e6ab87966b43f247920eab053fd5fdc925" uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" -version = "0.9.4" +version = "0.9.5" [[SuiteSparse]] deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] diff --git a/Project.toml b/Project.toml index a1cd0f4..e1faee6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,13 +1,14 @@ name = "LSHFunctions" uuid = "5134c85a-a9db-11e9-340f-8514dff59a31" authors = ["Will Shand "] -version = "0.1.1" +version = "0.1.2" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -17,7 +18,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Distributions = "0.22, 0.23" -Documenter = "0.24" +Documenter = "0.24, 0.25" FFTW = "1.2" QuadGK = "2.3" -julia = "1.3" +julia = "1.3, 1.4, 1.5" diff --git a/README.md b/README.md index 965da6e..e4005db 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ So far, there are hash functions for the similarity functions: - `MonteCarloHash` - `ChebHash` -This package still needs a lot of work, including improvement to the documentation and API. In general, if you want to draw one or more new hash functions, you can use the following syntax: +This package still needs a lot of work, including improvement to the documentation and API. ## Examples The easiest way to start constructing new hash functions is by calling `LSHFunction` with the following syntax: diff --git a/docs/Manifest.toml b/docs/Manifest.toml index 07ba923..fd8d95d 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -4,22 +4,22 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" [[BinaryProvider]] -deps = ["Libdl", "SHA"] -git-tree-sha1 = "5b08ed6036d9d3f0ee6369410b830f8873d4024c" +deps = ["Libdl", "Logging", "SHA"] +git-tree-sha1 = "ecdec412a9abc8db54c0efc5548c64dfce072058" uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232" -version = "0.5.8" +version = "0.5.10" [[ColorTypes]] deps = ["FixedPointNumbers", "Random"] -git-tree-sha1 = "c4c1cca28748906265ed62c788d6fe6f0134d264" +git-tree-sha1 = "cd19496d8943326b752d1712afd6ab79c7514d28" uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" -version = "0.10.0" +version = "0.10.5" [[Colors]] deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Reexport"] -git-tree-sha1 = "2fdeb981ebcf52cd800ddb6a0aa5eac34153552d" +git-tree-sha1 = "5639e44833cfcf78c6a73fbceb4da75611d312cd" uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" -version = "0.12.0" +version = "0.12.3" [[Conda]] deps = ["JSON", "VersionParsing"] @@ -27,12 +27,6 @@ git-tree-sha1 = "7a58bb32ce5d85f8bf7559aa7c2842f9aecf52fc" uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d" version = "1.4.1" -[[DataStructures]] -deps = ["InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "5a431d46abf2ef2a4d5d00bd0ae61f651cf854c8" -uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.17.10" - [[Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" @@ -43,29 +37,29 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[DocStringExtensions]] deps = ["LibGit2", "Markdown", "Pkg", "Test"] -git-tree-sha1 = "88bb0edb352b16608036faadcc071adda068582a" +git-tree-sha1 = "c5714d9bcdba66389612dc4c47ed827c64112997" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.8.1" +version = "0.8.2" [[Documenter]] deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"] -git-tree-sha1 = "3bacd94d853a6bccaee1d0104d8b06d29a7506ac" +git-tree-sha1 = "f3464968c65fc78846dad1c038c474a2c39bbb23" uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -version = "0.24.6" +version = "0.25.0" [[DocumenterTools]] deps = ["Base64", "DocStringExtensions", "Documenter", "FileWatching", "LibGit2", "Sass"] -git-tree-sha1 = "aa1a30dfa07a778b5ce8a448436725502e2913d0" +git-tree-sha1 = "6fa30234228d9020cbe31e393e9d183e944845bb" uuid = "35a29f4d-8980-5a13-9543-d66fff28ecb8" -version = "0.1.5" +version = "0.1.7" [[FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" [[FixedPointNumbers]] -git-tree-sha1 = "3ba9ea634d4c8b289d590403b4a06f8e227a6238" +git-tree-sha1 = "8fb797c37a3b7ced4327a05ac4ca0dd6a4f1ba92" uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" -version = "0.8.0" +version = "0.8.1" [[InteractiveUtils]] deps = ["Markdown"] @@ -96,10 +90,10 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" [[MacroTools]] -deps = ["DataStructures", "Markdown", "Random"] -git-tree-sha1 = "07ee65e03e28ca88bc9a338a3726ae0c3efaa94b" +deps = ["Markdown", "Random"] +git-tree-sha1 = "f7d2e3f654af75f01ec49be82c231c382214223a" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -version = "0.5.4" +version = "0.5.5" [[Markdown]] deps = ["Base64"] @@ -108,17 +102,11 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" -[[OrderedCollections]] -deps = ["Random", "Serialization", "Test"] -git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1" -uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.1.0" - [[Parsers]] deps = ["Dates", "Test"] -git-tree-sha1 = "0c16b3179190d3046c073440d94172cfc3bb0553" +git-tree-sha1 = "20ef902ea02f7000756a4bc19f7b9c24867c6211" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "0.3.12" +version = "1.0.6" [[Pkg]] deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"] @@ -136,9 +124,9 @@ version = "1.91.4" [[PyPlot]] deps = ["Colors", "LaTeXStrings", "PyCall", "Sockets", "Test", "VersionParsing"] -git-tree-sha1 = "ccecc72cf5b41a5de686bd76999040050a8a3472" +git-tree-sha1 = "67dde2482fe1a72ef62ed93f8c239f947638e5a2" uuid = "d330b81b-6aea-500a-939a-2ce795aea3ee" -version = "2.8.2" +version = "2.9.0" [[REPL]] deps = ["InteractiveUtils", "Markdown", "Sockets"] diff --git a/docs/src/function_hashing.md b/docs/src/function_hashing.md index 0a7be29..a869b7f 100644 --- a/docs/src/function_hashing.md +++ b/docs/src/function_hashing.md @@ -50,7 +50,7 @@ When ``f`` and ``g`` are allowed to take on complex values, ``g(x)`` is replaced Create a hash function for cosine similarity for functions in ``L^2([-1,1])``: -```jldoctest; setup = :(using LSHFunctions) +``` julia> hashfn = ChebHash(cossim, 50; interval=@interval(-1 ≤ x ≤ 1)); julia> n_hashes(hashfn) @@ -65,7 +65,7 @@ Bool Create a hash function for ``L^2`` distance defined over ``L^2([0,2\pi])``. Hash the functions `f(x) = cos(x)` and `f(x) = x/(2π)` using the returned [`ChebHash`](@ref): -```jldoctest; setup = :(using LSHFunctions, Random; Random.seed!(0)) +``` julia> hashfn = ChebHash(L2, 3; interval=@interval(0 ≤ x ≤ 2π)); julia> hashfn(cos) diff --git a/src/function_hashing/chebhash.jl b/src/function_hashing/chebhash.jl index 99aab17..184316e 100644 --- a/src/function_hashing/chebhash.jl +++ b/src/function_hashing/chebhash.jl @@ -5,6 +5,7 @@ ChebHash for hashing the L^2([-1,1]) function space. ================================================================# using FFTW +using Logging #======================== Global constants @@ -31,6 +32,7 @@ struct ChebHash{B, F<:SimilarityFunction, H<:LSHFunction, I<:RealInterval} interval::I ) where {B, F<:SimilarityFunction, H<:LSHFunction, I<:RealInterval} + @warn "ChebHash is deprecated. Starting in version 0.2.0 ChebHash will no longer be available." new{B,F,H,I}(hashfn, interval) end end @@ -71,7 +73,7 @@ join( # Examples Create a hash function for cosine similarity for functions in ``L^2([-1,1])``: -```jldoctest; setup = :(using LSHFunctions) +``` julia> hashfn = ChebHash(cossim, 50; interval=@interval(-1 ≤ x ≤ 1)); julia> n_hashes(hashfn) @@ -86,7 +88,7 @@ $(cossim |> LSHFunction |> hashtype) Create a hash function for ``L^2`` distance defined over ``L^2([0,2\\pi])``. Hash the functions `f(x) = cos(x)` and `f(x) = x/(2π)` using the returned `ChebHash`: -```jldoctest; setup = :(using LSHFunctions, Random; Random.seed!(0)) +``` julia> hashfn = ChebHash(L2, 3; interval=@interval(0 ≤ x ≤ 2π)); julia> hashfn(cos) diff --git a/src/hashes/mips_hash.jl b/src/hashes/mips_hash.jl index 4805fd3..ad1eb8c 100644 --- a/src/hashes/mips_hash.jl +++ b/src/hashes/mips_hash.jl @@ -4,6 +4,8 @@ Definition of MIPSHash for hashing on inner products. ================================================================# +using Logging + #======================== Typedefs ========================# @@ -52,7 +54,7 @@ Create a `MIPSHash` hash function for hashing on inner product similarity. # Examples `MIPSHash` is an [`AsymmetricLSHFunction`](@ref), and hence hashes must be computed using `index_hash` and `query_hash`. -```jldoctest; setup = :(using LSHFunctions) +``` julia> hashfn = MIPSHash(5; maxnorm=10); julia> x = rand(4); @@ -68,14 +70,14 @@ true You need to explicitly specify the `maxnorm` keyword parameter when constructing `MIPSHash`, otherwise you will get an error. -```jldoctest; setup = :(using LSHFunctions) +``` julia> hashfn = MIPSHash(5) ERROR: maxnorm must be specified for MIPSHash ``` You'll also get an error if you try to hash a vector that has norm greater than the `maxnorm` that you specified. -```jldoctest; setup = :(using LSHFunctions) +``` julia> hashfn = MIPSHash(; maxnorm=1); julia> index_hash(hashfn, ones(4)) @@ -98,6 +100,7 @@ See also: [`inner_prod`](@ref), [`ℓ2_norm`](@ref ℓp_norm) throw) else quote + @warn "MIPSHash is deprecated. Starting in version 0.2.0 MIPSHash will no longer be available." if n_hashes < 1 "n_hashes must be positive" |> ErrorException |> @@ -125,8 +128,8 @@ See also: [`inner_prod`](@ref), [`ℓ2_norm`](@ref ℓp_norm) MIPSHash{T}(coeff_A, coeff_B, scale, shift, Qshift, m, maxnorm, resize_pow2) - end end + end end MIPSHash(args...; dtype=DEFAULT_DTYPE, kws...) = diff --git a/test/doctests.jl b/test/doctests.jl index 0c4fcab..ec6c366 100644 --- a/test/doctests.jl +++ b/test/doctests.jl @@ -5,5 +5,5 @@ Doctests using Documenter, LSHFunctions, Test @testset "LSH doctests" begin - doctest(LSHFunctions; manual = false) + doctest(LSHFunctions) end