Skip to content

Commit 03746ec

Browse files
authored
Finish new TE and bump version (#446)
* improve docstring of transfer operator * apply Runic * bump version * add missing docrefs to transfer operator
1 parent 93219e5 commit 03746ec

147 files changed

Lines changed: 1330 additions & 1202 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Changelog is kept with respect to version 0.11 of Entropies.jl. From version v2.0 onwards, this package has been renamed to ComplexityMeasures.jl.
44

5+
## 3.10
6+
7+
- `TransferOperator` has been reworked and substantially enhanced. It is now a `ProbabilitiesEstimator` and works with any count based outcome space. See its new docstring for more!
8+
59
## 3.9
610

711
- Adding a new feature to `PowerSpectrum` estimator that adds a threshold for "small" amplitudes. The threshold is applied to the probabilities by default with an option to apply it to the power spectrum.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "ComplexityMeasures"
22
uuid = "ab4b797d-85ee-42ba-b621-05d793b346a2"
33
authors = "Kristian Agasøster Haaga <kahaaga@gmail.com>, George Datseries <datseris.george@gmail.com>"
44
repo = "https://github.com/juliadynamics/ComplexityMeasures.jl.git"
5-
version = "3.9.0"
5+
version = "3.10.0"
66

77
[deps]
88
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"

docs/make.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ using DocumenterCitations
3838

3939
bib = CitationBibliography(
4040
joinpath(@__DIR__, "refs.bib");
41-
style=:authoryear
41+
style = :authoryear
4242
)
4343

44-
build_docs_with_style(pages, ComplexityMeasures, StateSpaceSets;
45-
expandfirst = ["index.md"], bib,linkcheck=false
44+
build_docs_with_style(
45+
pages, ComplexityMeasures, StateSpaceSets;
46+
expandfirst = ["index.md"], bib, linkcheck = false
4647
)

docs/src/index.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,12 @@ ComplexityMeasures
66

77
## Latest news
88

9-
ComplexityMeasures.jl has been updated to v3!
9+
[`TransferOperator`](@ref) has been reworked and substantially enhanced. It is now a `ProbabilitiesEstimator` and works with any count based outcome space. See its new docstring for more!
1010

11-
The software has been massively improved and its core principles were
12-
redesigned to be extendable, accessible, and more closely based
13-
on the rigorous mathematics of probabilities and entropies.
11+
You can always check the
12+
[CHANGELOG.md](https://github.com/JuliaDynamics/ComplexityMeasures.jl/main/CHANGELOG.md) for details!
1413

15-
For more details of this new release, please see our [announcement
16-
post on discourse](https://discourse.julialang.org/t/complexitymeasures-jl-v3-a-mathematically-rigorous-software-for-probability-entropy-and-complexity/108562)
17-
or the central [Tutorial](@ref) of the v3 documentation.
18-
19-
In this v3 many concepts were renamed, but there is no formally
20-
breaking change. Everything that changed has been deprecated
21-
and is backwards compatible. You can see the
22-
[CHANGELOG.md](https://github.com/JuliaDynamics/ComplexityMeasures.jl/blob/v3.0.0/CHANGELOG.md) for more details!
14+
Note that the **DynamicalSystem.jl** library publishes general updates in a [JuliaLang Discourse post](https://discourse.julialang.org/t/dynamicalsystems-jl-news-updates-and-announcements/122079) that you can subscribe to!
2315

2416
## Documentation contents
2517

docs/src/measure_count.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function concrete_subtypes!(out, type::Type)
1717
else
1818
foreach(T -> concrete_subtypes!(out, T), subtypes(type))
1919
end
20-
out
20+
return out
2121
end
2222

2323
# ## Count Based Outcome Spaces
@@ -102,7 +102,7 @@ INFO_MEASURE_ESTIMATOR_GENERIC = concrete_subtypes(ComplexityMeasures.DiscreteIn
102102

103103
# so we count by multiplying
104104

105-
n_discrete_infoest_generic = length(INFO_MEASURES_DISCRETE)*length(INFO_MEASURE_ESTIMATOR_GENERIC)
105+
n_discrete_infoest_generic = length(INFO_MEASURES_DISCRETE) * length(INFO_MEASURE_ESTIMATOR_GENERIC)
106106

107107

108108
# In addition to the generic estimators,
@@ -196,7 +196,7 @@ n_extra_prob_measures = 2 * n_probs_discrete
196196
# ComplexityMeasures.jl are:
197197

198198
n_grand_total =
199-
n_discrete_info +
200-
n_diff_info +
201-
n_complexity_measures_total +
202-
n_extra_prob_measures
199+
n_discrete_info +
200+
n_diff_info +
201+
n_complexity_measures_total +
202+
n_extra_prob_measures

docs/src/probabilities.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,15 @@ RelativeAmount
121121
BayesianRegularization
122122
Shrinkage
123123
AddConstant
124+
```
125+
126+
### Transfer operator
127+
128+
```@docs
124129
TransferOperator
130+
transferoperator
131+
ApproximationIterative
132+
ApproximationEigen
125133
```
126134

127135
## [Encodings/Symbolizations API](@id encodings)

docs/src/tutorial.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ barplot(left_edges, probs; axis = (ylabel = "probability",))
117117

118118
using DynamicalSystemsBase
119119

120-
logistic_rule(u, r, t) = SVector(r*u[1]*(1 - u[1]))
120+
logistic_rule(u, r, t) = SVector(r * u[1] * (1 - u[1]))
121121
ds = DeterministicIteratedMap(logistic_rule, [0.4], 4.0)
122122
Y, t = trajectory(ds, 10_000; Ttr = 100)
123123
y = Y[:, 1]

src/ComplexityMeasures.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module ComplexityMeasures
22

33
# Use the README as the module docs
44
@doc let
5-
path = joinpath(dirname(@__DIR__), "README.md")
6-
include_dependency(path)
7-
read(path, String)
5+
path = joinpath(dirname(@__DIR__), "README.md")
6+
include_dependency(path)
7+
read(path, String)
88
end ComplexityMeasures
99

1010
using Reexport

src/complexity_measures/approximate_entropy.jl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ Base.@kwdef struct ApproximateEntropy{I, B, R} <: ComplexityEstimator
7676
r > 0 || throw(ArgumentError("r must be > 0. Got r=$(r)."))
7777
new{I, B, R}(m, τ, base, r)
7878
end
79-
function ApproximateEntropy(x::AbstractVector; m::Int = 2, τ::Int = 1,
80-
base = MathConstants.e, r = 0.2 * Statistics.std(x))
79+
function ApproximateEntropy(
80+
x::AbstractVector; m::Int = 2, τ::Int = 1,
81+
base = MathConstants.e, r = 0.2 * Statistics.std(x)
82+
)
8183
ApproximateEntropy(m, τ, base, r)
8284
end
8385
end
@@ -86,12 +88,12 @@ function complexity(c::ApproximateEntropy, x::AbstractStateSpaceSet)
8688
throw(ArgumentError("Approximate entropy is only computable for timeseries."))
8789
end
8890

89-
function complexity(c::ApproximateEntropy, x::AbstractVector{T}) where T
91+
function complexity(c::ApproximateEntropy, x::AbstractVector{T}) where {T}
9092
(; m, τ, r, base) = c
9193

9294
# Definition in https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7515030/
9395
if m == 1
94-
return compute_ϕ(x; k = m, r, τ, base)
96+
return compute_ϕ(x; k = m, r, τ, base)
9597
else
9698
ϕᵐ = compute_ϕ(x; k = m, r, τ, base)
9799
ϕᵐ⁺¹ = compute_ϕ(x; k = m + 1, r, τ, base)
@@ -125,14 +127,16 @@ C_i^k(r) = \\textrm{number of } j \\textrm{ such that } d({\\bf u}_i, {\\bf u}_j
125127
where ``d`` is the maximum (Chebyshev) distance, `r` is the tolerance, and `N` is the
126128
length of the original scalar-valued time series `x`.
127129
"""
128-
function compute_ϕ(x::AbstractVector{T}; r = 0.2 * Statistics.std(x), k::Int = 2,
129-
τ::Int = 1, base = MathConstants.e) where T <: Real
130-
τs = 0:τ:(k - 1)*τ
130+
function compute_ϕ(
131+
x::AbstractVector{T}; r = 0.2 * Statistics.std(x), k::Int = 2,
132+
τ::Int = 1, base = MathConstants.e
133+
) where {T <: Real}
134+
τs = 0:τ:((k - 1) * τ)
131135
pts = genembed(x, τs)
132136
tree = KDTree(pts, Chebyshev())
133137

134138
# Account for `τ != 1` in the normalization constant.
135-
f = length(x) - (k - 1)*τ
139+
f = length(x) - (k - 1) * τ
136140

137141
# `inrangecount` counts the query point itself, which is wanted for approximate entropy,
138142
# because there are always neighbors and thus log(0) is never encountered.

src/complexity_measures/bubble_entropy.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ end
6262
function complexity_normalized(est::BubbleEntropy, x)
6363
o_m = BubbleSortSwaps(m = est.m)
6464
o_m₊₁ = BubbleSortSwaps(m = est.m + 1)
65-
h_m = information(est.definition, o_m, x)
66-
h_m₊₁ = information(est.definition, o_m₊₁, x)
65+
h_m = information(est.definition, o_m, x)
66+
h_m₊₁ = information(est.definition, o_m₊₁, x)
6767

6868
# The normalized factor as (I think) described in Manis et al. (2017).
6969
# Their description is a bit unclear to me.
7070
h_max_m = information_maximum(est.definition, o_m, x)
7171
h_max_m₊₁ = information_maximum(est.definition, o_m₊₁, x)
7272
norm_factor = (h_max_m₊₁ - h_max_m) # maximum difference for dims `m` and `m + 1`
7373

74-
return (h_m₊₁ - h_m)/norm_factor
75-
end
74+
return (h_m₊₁ - h_m) / norm_factor
75+
end

0 commit comments

Comments
 (0)