Skip to content

Commit ed6f2ac

Browse files
committed
add docstrings to convenience calls
1 parent c9084cf commit ed6f2ac

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

src/entropies/convenience_definitions.jl

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,41 @@
11
# This file defines and exports some convenience definition of entropies
22
# for commonly used names in the literature. They aren't actually new entropies
33
# as discussed extensively in the documentation.
4+
export entropy_permutation, entropy_spatial_permutation, entropy_wavelet
45

5-
function entropy_permutation(args...)
6+
"""
7+
entropy_permutation(x; τ = 1, m = 3, base = MathConstants.e)
68
9+
Compute the permutation entropy of order `m` with delay/lag `τ`.
10+
This function is just a convenience call to:
11+
```julia
12+
est = SymbolicPermutation(; m, τ)
13+
entropy_renyi(x, est; base, q = 1)
14+
```
15+
See [`SymbolicPermutation`](@ref) for more info.
16+
Similarly, one can use `SymbolicWeightedPermutation` or `SymbolicAmplitudeAwarePermutation`
17+
for the weighted/amplitude-aware versions.
18+
"""
19+
function entropy_permutation(x; τ = 1, m = 3, base = MathConstants.e)
20+
est = SymbolicPermutation(; m, τ)
21+
entropy_renyi(x, est; base, q = 1)
722
end
823

9-
function entropy_spatial_permutation(args...)
24+
"""
25+
entropy_spatial_permutation(x, stencil, periodic = true; kwargs...)
1026
27+
Compute the spatial permutation entropy of `x` given the `stencil`.
28+
Here `x` must be a matrix or higher dimensional `Array` containing spatial data.
29+
This function is just a convenience call to:
30+
```julia
31+
est = SpatialSymbolicPermutation(stencil, x, periodic)
32+
entropy_renyi(x, est; kwargs..., q = 1)
33+
```
34+
See [`SpatialSymbolicPermutation`](@ref) for more info, or how to encode stencils.
35+
"""
36+
function entropy_spatial_permutation(x, stencil, periodic = true; kwargs...)
37+
est = SpatialSymbolicPermutation(stencil, x, periodic)
38+
entropy_renyi(x, est; kwargs..., q = 1)
1139
end
1240

1341
"""
@@ -18,7 +46,7 @@ Compute the wavelet entropy. This function is just a convenience call to:
1846
est = WaveletOverlap(wavelet)
1947
entropy_renyi(x, est; base, q = 1)
2048
```
21-
See [`WaveletOverlap`](@ref) for more.
49+
See [`WaveletOverlap`](@ref) for more info.
2250
"""
2351
function entropy_wavelet(x; wavelet = Wavelets.WT.Daubechies{12}(), base = MathConstants.e)
2452
est = WaveletOverlap(wavelet)

src/probabilities_estimators/permutation_ordinal/SymbolicPermutation.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ abstract type PermutationProbabilityEstimator <: ProbabilitiesEstimator end
1313
Symbolic, permutation-based probabilities/entropy estimators.
1414
`m` is the permutation order (or the symbol size or the embedding dimension) and
1515
`τ` is the delay time (or lag).
16+
They are used to define the permutation entropies[^BandtPompe2002].
1617
1718
## Repeated values during symbolization
1819

src/probabilities_estimators/permutation_ordinal/spatial_permutation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The length of the stencil decides the order of the permutation entropy, and the
2424
within the stencil dictates the order that pixels are compared with.
2525
The pixel without any offset is always first in the order.
2626
27-
After having defined `est`, one calculates the permutation entropy of ordinal patterns
27+
After having defined `est`, one calculates the spatial permutation entropy
2828
by calling [`entropy_renyi`](@ref) with `est`, and with the array data.
2929
To apply this to timeseries of spatial data, simply loop over the call, e.g.:
3030
```julia

0 commit comments

Comments
 (0)