Skip to content

Commit 5909d72

Browse files
authored
Transfer entropy syntax bug (#338)
* Add test * Changelog and version
1 parent 74bb6f8 commit 5909d72

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "CausalityTools"
22
uuid = "5520caf5-2dd7-5c5d-bfcb-a00e56ac49f7"
33
authors = ["Kristian Agasøster Haaga <kahaaga@gmail.com>", "Tor Einar Møller <temolle@gmail.com>", "George Datseris <datseris.george@gmail.com>"]
44
repo = "https://github.com/kahaaga/CausalityTools.jl.git"
5-
version = "2.9.0"
5+
version = "2.9.1"
66

77
[deps]
88
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.9
4+
5+
### Bug fixes
6+
7+
- Fixed bug in `transferentropy` function which yielded identical results in both directions for the bivariate case.
8+
39
## 2.8.0
410

511
Moved to DynamicalSystemsBase v3.0 (`trajectory` now returns both the data and the time

src/methods/infomeasures/transferentropy/transferentropy.jl

+6-3
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,15 @@ include("optimization/optimization.jl")
119119
include("TEShannon.jl")
120120
include("TERenyiJizba.jl")
121121

122-
function transferentropy(args...; kwargs...)
123-
return estimate(args...; kwargs...)
122+
function transferentropy(measure::TransferEntropy, est::TE_ESTIMATORS, args...; kwargs...)
123+
return estimate(measure, est, args...; kwargs...)
124+
end
125+
function transferentropy(est::TE_ESTIMATORS, args...; kwargs...)
126+
return estimate(TEShannon(), est, args...; kwargs...)
124127
end
125128

126129
function estimate(est::TE_ESTIMATORS, args...; kwargs...)
127-
estimate(TEShannon(), est, args...; kwargs...)
130+
return estimate(TEShannon(), est, args...; kwargs...)
128131
end
129132

130133
function estimate(measure::TransferEntropy, est::TE_ESTIMATORS, x...)

test/methods/infomeasures/transferentropy.jl

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
x, y, z = rand(1000), rand(1000), rand(1000)
22

3+
# Transfer entropy is asymmetric.
4+
pest = SymbolicPermutation(m = 2)
5+
@test transferentropy(TEShannon(), pest, x, y) != transferentropy(TEShannon(), pest, y, x)
6+
37
est = Lindner( k = 5)
48
@test transferentropy(est, x, y) isa Real
59

0 commit comments

Comments
 (0)