PermutationEntropy
Permutation entropy: disorder in the ORDER of neighbouring samples.
Explore this node in the cookbook →
data
entropy
- Type name
signal:PermutationEntropy- Plane
signal- Tags
analysis- Language
python- Tier
in-process- Bundle
complexity- Source
node-bundles/complexity/permutation_entropy.py- Availability
- available
Slots
| Slot | Direction | Type | |
|---|---|---|---|
data | input | ARRAY | |
entropy | output | ARRAY |
Parameters
permutation
| Name | Type | Default | Range | Doc |
|---|---|---|---|---|
order | int | 3 | 2 … 7 | How many samples make one ordering pattern. |
delay | int | 1 | 1 … 100 | Samples between the members of a pattern; raise it for a slower rhythm. |
normalize | bool | true | Scale to 0..1 against the most disordered signal. |
Source
The current source of this node, as it stands in the goofi repository at node-bundles/complexity/permutation_entropy.py.
"""PermutationEntropy — how disordered a signal's ORDER is, from antropy.
Reads only the ranking of neighbouring samples, so amplitude scaling and slow drift do not move
it. The last axis is time and is consumed; every axis before it survives.
"""
import antropy
import numpy as np
import goofi
class PermutationEntropy(goofi.Node):
"""Permutation entropy: disorder in the ORDER of neighbouring samples."""
TAGS = ["analysis"]
INPUTS = {"data": goofi.InputSlot(goofi.DataType.ARRAY, required=True)}
OUTPUTS = {"entropy": goofi.DataType.ARRAY}
PARAMS = {
"permutation": {
"order": goofi.IntParam(3, 2, 7, doc="How many samples make one ordering pattern."),
"delay": goofi.IntParam(
1, 1, 100, doc="Samples between the members of a pattern; raise it for a slower rhythm."
),
"normalize": goofi.BoolParam(True, doc="Scale to 0..1 against the most disordered signal."),
}
}
def process(self, data):
p = self.params.permutation
out = np.apply_along_axis(
antropy.perm_entropy,
-1,
np.asarray(data.data, dtype=np.float64),
order=p.order,
delay=p.delay,
normalize=p.normalize,
)
return out.astype(np.float32), data.drop_axis(-1)