From e9c88befd3d4ece08f30f7906c9ca5082e0aed75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Agas=C3=B8ster=20Haaga?= Date: Wed, 21 Nov 2018 04:58:20 +0100 Subject: [PATCH 1/6] Add tolerance for tests --- test/wrappers_te.jl | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/test/wrappers_te.jl b/test/wrappers_te.jl index 53c945216..90b35bef6 100644 --- a/test/wrappers_te.jl +++ b/test/wrappers_te.jl @@ -3,34 +3,35 @@ using Test, Distances d1 = rand(50) d2 = rand(50) r = rand(50) + tol = 1e-8 # Directly from time series te(d1, r, estimator = :tetogrid) - @test te(d1, r, estimator = :tetogrid) >= 0 - @test te(d2, r, estimator = :tetogrid) >= 0 - @test te(d1, r, estimator = :tefreq) >= 0 - @test te(d2, r, estimator = :tefreq) >= 0 - @test te(d1, r, estimator = :tekNN) >= 0 - @test te(d2, r, estimator = :tekraskov) >= 0 + @test te(d1, r, estimator = :tetogrid) >= 0 - tol + @test te(d2, r, estimator = :tetogrid) >= 0 - tol + @test te(d1, r, estimator = :tefreq) >= 0 - tol + @test te(d2, r, estimator = :tefreq) >= 0 - tol + @test te(d1, r, estimator = :tekNN) >= 0 - tol + @test te(d2, r, estimator = :tekraskov) >= 0 - tol ######################### # Surrogates ######################### - @test te(d1, r, which_is_surr = :driver) >= 0 - @test te(d1, r, which_is_surr = :response) >= 0 - @test te(d1, r, which_is_surr = :none) >= 0 + @test te(d1, r, which_is_surr = :driver) >= 0 - tol + @test te(d1, r, which_is_surr = :response) >= 0 - tol + @test te(d1, r, which_is_surr = :none) >= 0 - tol - @test te(d1, r, which_is_surr = :both, surr_func = aaft) >= 0 - @test te(d1, r, which_is_surr = :both, surr_func = iaaft) >= 0 - @test te(d1, r, which_is_surr = :both, surr_func = randomphases) >= 0 - @test te(d1, r, which_is_surr = :both, surr_func = randomamplitudes) >= 0 - @test te(d1, r, which_is_surr = :both, surr_func = randomshuffle) >= 0 + @test te(d1, r, which_is_surr = :both, surr_func = aaft) >= 0 - tol + @test te(d1, r, which_is_surr = :both, surr_func = iaaft) >= 0 - tol + @test te(d1, r, which_is_surr = :both, surr_func = randomphases) >= 0 - tol + @test te(d1, r, which_is_surr = :both, surr_func = randomamplitudes) >= 0 - tol + @test te(d1, r, which_is_surr = :both, surr_func = randomshuffle) >= 0 - tol ######################### # Forward prediction lags ######################### - @test te(d1, r, ν = 1) >= 0 - @test te(d1, r, ν = 5) >= 0 + @test te(d1, r, ν = 1) >= 0 - tol + @test te(d1, r, ν = 5) >= 0 - tol ######################### # Embedding lags and dimensions @@ -38,14 +39,14 @@ using Test, Distances d1 = rand(100) d2 = rand(100) r = rand(100) - @test te(d1, r, ν = 1, τ = 2, dim = 4) >= 0 - @test te(d1, r, ν = 3, τ = 3, dim = 5) >= 0 + @test te(d1, r, ν = 1, τ = 2, dim = 4) >= 0 - tol + @test te(d1, r, ν = 3, τ = 3, dim = 5) >= 0 - tol ######################### # Tuning the bins ######################### - @test te(d1, r, n_ϵ = 10) >= 0 - @test te(d1, r, n_ϵ = 10, max_numbins = 5, min_numbins = 2) >= 0 + @test te(d1, r, n_ϵ = 10) >= 0 - tol + @test te(d1, r, n_ϵ = 10, max_numbins = 5, min_numbins = 2) >= 0 - tol end # maxlag = 2 From 0013c3a6d9bc588043bb55478fa3e5c77cfbaebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Agas=C3=B8ster=20Haaga?= Date: Sun, 25 Nov 2018 02:03:25 +0100 Subject: [PATCH 2/6] Require Julia 1.0 --- REQUIRE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REQUIRE b/REQUIRE index bfbefe3d4..0538a9d71 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.7 +julia 1.0 InplaceOps DynamicalSystemsBase DynamicalSystems From 79c08878075be7229cb643085f69ea838830a352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Agas=C3=B8ster=20Haaga?= Date: Sun, 25 Nov 2018 15:21:36 +0100 Subject: [PATCH 3/6] Update requirements. --- REQUIRE | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/REQUIRE b/REQUIRE index 0538a9d71..0b8ce4f5d 100644 --- a/REQUIRE +++ b/REQUIRE @@ -9,7 +9,6 @@ Plots DifferentialEquations TimeseriesSurrogates 0.2.1 Simplices 0.2.1 -StateSpaceReconstruction 0.2.3 0.2.4 -PerronFrobenius 0.1.3 0.1.4 -TransferEntropy 0.2.3 -DynamicalSystems +StateSpaceReconstruction 0.3.0 +PerronFrobenius 0.2.0 +TransferEntropy 0.3.1 From 675fe4eea97dc6a7e081e863b00fab8bb9e44674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Agas=C3=B8ster=20Haaga?= Date: Sun, 25 Nov 2018 15:21:55 +0100 Subject: [PATCH 4/6] Fix imports. --- src/CausalityTools.jl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/CausalityTools.jl b/src/CausalityTools.jl index b4a250378..64b0dadda 100644 --- a/src/CausalityTools.jl +++ b/src/CausalityTools.jl @@ -8,12 +8,6 @@ using Statistics using RecipesBase using Plots -import DynamicalSystemsBase: - DynamicalSystem, - ContinuousDynamicalSystem, - DiscreteDynamicalSystem, - Dataset, - trajectory @reexport using TimeseriesSurrogates @reexport using StateSpaceReconstruction @@ -21,6 +15,13 @@ import DynamicalSystemsBase: @reexport using TransferEntropy using StateSpaceReconstruction: GroupSlices +import DynamicalSystemsBase: + DynamicalSystem, + ContinuousDynamicalSystem, + DiscreteDynamicalSystem, + Dataset, + trajectory + # Example systems include("systems/Systems.jl") @@ -30,8 +31,11 @@ include("surrogates/surrogates.jl") # Wrappers of the different methods. include("method_wrappers/highlevel_methods.jl") -export Dataset, - DynamicalSystem, DiscreteDynamicalSystem, ContinuousDynamicalSystem, - trajectory +export +Dataset, +DynamicalSystem, +DiscreteDynamicalSystem, +ContinuousDynamicalSystem, +trajectory end # module From 6543292f32af5faa0c9229314ffed9ec02a56519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Agas=C3=B8ster=20Haaga?= Date: Sun, 25 Nov 2018 15:27:21 +0100 Subject: [PATCH 5/6] Update manifest. --- Manifest.toml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index fe3fe87e1..11eb08697 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -33,9 +33,9 @@ version = "0.8.10" [[BinaryProvider]] deps = ["Libdl", "Pkg", "SHA", "Test"] -git-tree-sha1 = "9930c1a6cd49d9fcd7218df6be417e6ae4f1468a" +git-tree-sha1 = "055eb2690182ebc31087859c3dd8598371d3ef9e" uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232" -version = "0.5.2" +version = "0.5.3" [[BlackBoxOptim]] deps = ["CPUTime", "Compat", "Distributed", "Distributions", "LinearAlgebra", "Logging", "Pkg", "Printf", "Random", "SHA", "Serialization", "Statistics", "StatsBase", "Test"] @@ -139,9 +139,9 @@ version = "4.7.0" [[DelayEmbeddings]] deps = ["Distances", "LinearAlgebra", "NearestNeighbors", "StaticArrays", "StatsBase", "Test"] -git-tree-sha1 = "daa7e6a0e354f47d8fb17eb4fe68099fa86e1896" +git-tree-sha1 = "6d42460dc2c84058850b26da7b5174fb6fcd213e" uuid = "5732040d-69e3-5649-938a-b6b4f237613f" -version = "0.1.0" +version = "0.1.1" [[DelimitedFiles]] deps = ["Mmap"] @@ -285,9 +285,9 @@ version = "0.16.4" [[DocStringExtensions]] deps = ["LibGit2", "Markdown", "Pkg", "Test"] -git-tree-sha1 = "a016e0bfe98a748c4488e2248c2ef4c67d6fdd35" +git-tree-sha1 = "1df01539a1c952cef21f2d2d1c092c2bcf0177d7" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.5.0" +version = "0.6.0" [[Documenter]] deps = ["Base64", "DocStringExtensions", "InteractiveUtils", "LibGit2", "Logging", "Markdown", "Pkg", "REPL", "Random", "Test", "Unicode"] @@ -390,9 +390,9 @@ version = "0.1.1" [[JSON]] deps = ["Dates", "Distributed", "Mmap", "Sockets", "Test", "Unicode"] -git-tree-sha1 = "fec8e4d433072731466d37ed0061b3ba7f70eeb9" +git-tree-sha1 = "1f7a25b53ec67f5e9422f1f551ee216503f4a0fa" uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -version = "0.19.0" +version = "0.20.0" [[LazyArrays]] deps = ["FillArrays", "LinearAlgebra", "StaticArrays", "Test"] @@ -494,9 +494,9 @@ version = "0.4.2" [[OffsetArrays]] deps = ["DelimitedFiles", "Test"] -git-tree-sha1 = "f8cd140824f74f2948ff8660bc2292e16d29c1b7" +git-tree-sha1 = "f446248f2dfbc13039a0b90994dd25b059b01eab" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "0.8.1" +version = "0.9.0" [[Optim]] deps = ["Calculus", "DiffEqDiffTools", "ForwardDiff", "LineSearches", "LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "PositiveFactorizations", "Printf", "Random", "SparseArrays", "StatsBase", "Test"] @@ -548,9 +548,9 @@ version = "0.1.2" [[PerronFrobenius]] deps = ["Conda", "Distributed", "Documenter", "InplaceOps", "LinearAlgebra", "Parameters", "Printf", "PyCall", "RecipesBase", "Reexport", "SharedArrays", "Simplices", "SparseArrays", "StateSpaceReconstruction", "StaticArrays", "Test"] -git-tree-sha1 = "5e43f20dc37812b364c00d09e52a64050a80de59" +git-tree-sha1 = "6c1471a5c3c36859c62e48d8b4c793ac16fae4d8" uuid = "260eed61-d0e8-5f1e-b040-a9756a401c97" -version = "0.1.3" +version = "0.2.0" [[Pkg]] deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] @@ -718,16 +718,16 @@ uuid = "276daf66-3868-5448-9aa4-cd146d93841b" version = "0.7.2" [[StateSpaceReconstruction]] -deps = ["Conda", "Distributions", "DynamicalSystems", "DynamicalSystemsBase", "LinearAlgebra", "Parameters", "PyCall", "Reexport", "Simplices", "StaticArrays", "Statistics", "Test"] -git-tree-sha1 = "57019b8516555b32f25dd52c5e9e6dfd8786647e" +deps = ["Conda", "Distributions", "LinearAlgebra", "PyCall", "Reexport", "Simplices", "StaticArrays", "Statistics", "Test"] +git-tree-sha1 = "1137310fbd695e00b5bcdaf68677b6383e6e1151" uuid = "1441a9f6-6a74-5418-a591-cdf1d78a07f0" -version = "0.2.3" +version = "0.3.0" [[StaticArrays]] deps = ["InteractiveUtils", "LinearAlgebra", "Random", "Statistics", "Test"] -git-tree-sha1 = "ebc5c2a27d91d5ec611a9861168182e2168effd3" +git-tree-sha1 = "97c4bf0f647488dd7ac01ea12be5885f88762938" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "0.9.2" +version = "0.10.0" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] @@ -791,9 +791,9 @@ version = "0.2.1" [[TransferEntropy]] deps = ["Conda", "Distances", "Distributions", "Interpolations", "NearestNeighbors", "PerronFrobenius", "PyCall", "Reexport", "Simplices", "SpecialFunctions", "StateSpaceReconstruction", "Test"] -git-tree-sha1 = "fee82641cbefd0a86a64c42023c78667529c733a" +git-tree-sha1 = "c335bef72a3ff612b54f30bc0df38bd8f7a51c04" uuid = "ea221983-52f3-5440-99c7-13ea201cd633" -version = "0.2.3" +version = "0.3.1" [[TreeViews]] deps = ["Test"] From e02f72e5795fe55b784baa96810d15fef54fc843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Agas=C3=B8ster=20Haaga?= Date: Sun, 25 Nov 2018 15:27:38 +0100 Subject: [PATCH 6/6] Be specific that `embed` is from StateSpaceReconstruction --- src/method_wrappers/transferentropy.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/method_wrappers/transferentropy.jl b/src/method_wrappers/transferentropy.jl index e45ed322e..9206d8c9e 100644 --- a/src/method_wrappers/transferentropy.jl +++ b/src/method_wrappers/transferentropy.jl @@ -1,3 +1,5 @@ +import StateSpaceReconstruction: embed + """ te(driver, response; estimator = :tetogrid, @@ -109,22 +111,22 @@ function transferentropy(driver, response; # computes conditional mutual information. if !(typeof(E) == Embeddings.AbstractEmbedding) || !(typeof(v) == TEVars) if dim == 3 - E = embed([driver, response], [2, 2, 1], [ν, 0, 0]) + E = StateSpaceReconstruction.embed([driver, response], [2, 2, 1], [ν, 0, 0]) v = TEVars([1], [2], [3]) elseif dim == 4 - E = embed([driver, response], [2, 2, 2, 1], [ν, 0, -τ, 0]) + E = StateSpaceReconstruction.embed([driver, response], [2, 2, 2, 1], [ν, 0, -τ, 0]) v = TEVars([1], [2, 3], [4]) elseif dim == 5 - E = embed([driver, response], [2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, 0]) + E = StateSpaceReconstruction.embed([driver, response], [2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, 0]) v = TEVars([1], [2, 3, 4], [5]) elseif dim == 6 - E = embed([driver, response], [2, 2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, -3*τ, 0]) + E = StateSpaceReconstruction.embed([driver, response], [2, 2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, -3*τ, 0]) v = TEVars([1], [2, 3, 4, 5], [6]) elseif dim == 7 - E = embed([driver, response], [2, 2, 2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, -3*τ, -4*τ, 0]) + E = StateSpaceReconstruction.embed([driver, response], [2, 2, 2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, -3*τ, -4*τ, 0]) v = TEVars([1], [2, 3, 4, 5, 6], [7]) elseif dim == 8 - E = embed([driver, response], [2, 2, 2, 2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, -3*τ, -4*τ, -5*τ, 0]) + E = StateSpaceReconstruction.embed([driver, response], [2, 2, 2, 2, 2, 2, 2, 1], [ν, 0, -τ, -2*τ, -3*τ, -4*τ, -5*τ, 0]) v = TEVars([1], [2, 3, 4, 5, 6, 7], [8]) end end