{"id":"permutation_entropy_distance","title":"Permutation-entropy distance","family":"feature-based","definition":"reference","intro_en":"Turn length-three windows into ordering patterns and compute each distribution's normalized Shannon entropy. Compare the two scalar entropies with an absolute difference. The score measures equality of this particular summary, so distinct pattern distributions can still have zero distance.","intro_zh":"把三点窗口转换成排序模式，分别计算模式分布的归一化 Shannon 熵，再取两标量之差的绝对值。该分数比较这一特定摘要，因而不同模式分布仍可能得到零距离。","steps_en":["Form overlapping windows with order 3 and delay 1.","Stably rank each window and count all six possible permutations.","Compute H=-sum(p log p)/log(6) for each distribution.","Take |H(x)-H(y)| and remember that entropy discards pattern identities."],"steps_zh":["使用阶数 3、延迟 1 构造重叠窗口。","稳定排序各窗口，并统计全部六种排列。","对各分布计算 H=-sum(p log p)/log(6)。","计算 |H(x)-H(y)|，同时注意熵舍弃具体模式身份。"],"formula":"d = |H(p)-H(q)|; H(p)=-sum(p log p)/log(3!)","caveats_en":["Order 3, delay 1 and stable tie-breaking by earlier position are explicit choices; frequent ties can change the interpretation.","Short sequences provide sparse pattern counts; overlapping windows are not independent samples.","Equal entropy does not imply equal ordinal distributions or similar dynamics."],"caveats_zh":["阶数 3、延迟 1，以及按较早位置优先的稳定并列处理都是明确选择；大量并列值会改变解释。","短序列的模式统计稀疏，重叠窗口也不是独立样本。","相同的熵不意味着相同的模式分布或动力学。"],"sources":[{"label":"Bandt and Pompe (2002), permutation entropy","url":"https://doi.org/10.1103/PhysRevLett.88.174102"},{"label":"Exact illustrative inputs and encoder definitions","url":"https://github.com/ZipengWu365/EchoTime/blob/main/tools/method_animation_data/feature_model_embedding.py"},{"label":"EchoTime low-level implementation","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/similarity_methods.py"}],"x":[0.0,0.8769216919004693,0.8094744111674236,0.7863961030678929,0.3905255888325767,-0.5769216919004693,-0.6000000000000001,-0.09587051423531628,0.2094744111674235,1.0863961030678926,1.5905255888325764,0.9958705142353173,0.6000000000000002,0.20412948576468337,-0.39052558883257615,0.11360389693210537],"y":[-0.2003300858899106,0.185,0.5703300858899106,1.005,1.0003300858899107,0.3250000000000002,-0.35033008588991066,-0.3550000000000001,0.07966991411008931,0.46499999999999997,0.8503300858899105,1.2849999999999995,1.2803300858899114,0.6050000000000002,-0.07033008588991083,-0.07500000000000043],"parameters":{"order":3,"delay":1,"tie_policy":"stable by index","log_base":"e","entropy_normalized":true},"result":{"label":"distance","value":0.13023243694146447,"detail":"Normalized entropies H(x)=0.79848069, H(y)=0.66824825"},"frames":[{"phase":0,"caption":"Rank each length-three window; 1 windows counted so far.","panel":{"kind":"bars","title":"Observed ordinal-pattern proportions","a":[0.0,1.0,0.0,0.0,0.0,0.0],"a_label":"x pattern mass","b":[1.0,0.0,0.0,0.0,0.0,0.0],"b_label":"y pattern mass","labels":["012","021","102","120","201","210"],"marker":1},"input_highlight":[0,1,2]},{"phase":0,"caption":"Rank each length-three window; 3 windows counted so far.","panel":{"kind":"bars","title":"Observed ordinal-pattern proportions","a":[0.0,0.3333333333333333,0.0,0.0,0.0,0.6666666666666666],"a_label":"x pattern mass","b":[0.6666666666666666,0.3333333333333333,0.0,0.0,0.0,0.0],"b_label":"y pattern mass","labels":["012","021","102","120","201","210"],"marker":5},"input_highlight":[2,3,4]},{"phase":0,"caption":"Rank each length-three window; 5 windows counted so far.","panel":{"kind":"bars","title":"Observed ordinal-pattern proportions","a":[0.0,0.2,0.0,0.0,0.0,0.8],"a_label":"x pattern mass","b":[0.4,0.2,0.0,0.0,0.0,0.4],"b_label":"y pattern mass","labels":["012","021","102","120","201","210"],"marker":5},"input_highlight":[4,5,6]},{"phase":0,"caption":"Rank each length-three window; 8 windows counted so far.","panel":{"kind":"bars","title":"Observed ordinal-pattern proportions","a":[0.25,0.125,0.125,0.0,0.0,0.5],"a_label":"x pattern mass","b":[0.375,0.125,0.125,0.0,0.0,0.375],"b_label":"y pattern mass","labels":["012","021","102","120","201","210"],"marker":0},"input_highlight":[7,8,9]},{"phase":0,"caption":"Rank each length-three window; 11 windows counted so far.","panel":{"kind":"bars","title":"Observed ordinal-pattern proportions","a":[0.2727272727272727,0.09090909090909091,0.09090909090909091,0.0,0.09090909090909091,0.45454545454545453],"a_label":"x pattern mass","b":[0.45454545454545453,0.18181818181818182,0.09090909090909091,0.0,0.0,0.2727272727272727],"b_label":"y pattern mass","labels":["012","021","102","120","201","210"],"marker":5},"input_highlight":[10,11,12]},{"phase":0,"caption":"Rank each length-three window; 14 windows counted so far.","panel":{"kind":"bars","title":"Observed ordinal-pattern proportions","a":[0.21428571428571427,0.07142857142857142,0.07142857142857142,0.07142857142857142,0.07142857142857142,0.5],"a_label":"x pattern mass","b":[0.35714285714285715,0.14285714285714285,0.07142857142857142,0.0,0.0,0.42857142857142855],"b_label":"y pattern mass","labels":["012","021","102","120","201","210"],"marker":3},"input_highlight":[13,14,15]},{"phase":1,"caption":"Keep the full six-pattern distribution, including patterns with zero count.","panel":{"kind":"bars","title":"Final ordinal-pattern distributions","a":[0.21428571428571427],"a_label":"x features","b":[0.35714285714285715],"b_label":"y features","labels":["012"],"marker":0}},{"phase":1,"caption":"Keep the full six-pattern distribution, including patterns with zero count.","panel":{"kind":"bars","title":"Final ordinal-pattern distributions","a":[0.21428571428571427,0.07142857142857142],"a_label":"x features","b":[0.35714285714285715,0.14285714285714285],"b_label":"y features","labels":["012","021"],"marker":1}},{"phase":1,"caption":"Keep the full six-pattern distribution, including patterns with zero count.","panel":{"kind":"bars","title":"Final ordinal-pattern distributions","a":[0.21428571428571427,0.07142857142857142,0.07142857142857142],"a_label":"x features","b":[0.35714285714285715,0.14285714285714285,0.07142857142857142],"b_label":"y features","labels":["012","021","102"],"marker":2}},{"phase":1,"caption":"Keep the full six-pattern distribution, including patterns with zero count.","panel":{"kind":"bars","title":"Final ordinal-pattern distributions","a":[0.21428571428571427,0.07142857142857142,0.07142857142857142,0.07142857142857142],"a_label":"x features","b":[0.35714285714285715,0.14285714285714285,0.07142857142857142,0.0],"b_label":"y features","labels":["012","021","102","120"],"marker":3}},{"phase":1,"caption":"Keep the full six-pattern distribution, including patterns with zero count.","panel":{"kind":"bars","title":"Final ordinal-pattern distributions","a":[0.21428571428571427,0.07142857142857142,0.07142857142857142,0.07142857142857142,0.07142857142857142],"a_label":"x features","b":[0.35714285714285715,0.14285714285714285,0.07142857142857142,0.0,0.0],"b_label":"y features","labels":["012","021","102","120","201"],"marker":4}},{"phase":1,"caption":"Keep the full six-pattern distribution, including patterns with zero count.","panel":{"kind":"bars","title":"Final ordinal-pattern distributions","a":[0.21428571428571427,0.07142857142857142,0.07142857142857142,0.07142857142857142,0.07142857142857142,0.5],"a_label":"x features","b":[0.35714285714285715,0.14285714285714285,0.07142857142857142,0.0,0.0,0.42857142857142855],"b_label":"y features","labels":["012","021","102","120","201","210"],"marker":5}},{"phase":2,"caption":"Accumulate the stated distribution functional; zero-mass terms contribute zero.","panel":{"kind":"bars","title":"Per-pattern normalized entropy contributions","a":[0.1842297314937375],"a_label":"x entropy terms","b":[0.20522912072582364],"b_label":"y entropy terms","labels":["012"],"marker":0},"value":0.1842297314937375,"value_label":"partial H(x)"},{"phase":2,"caption":"Accumulate the stated distribution functional; zero-mass terms contribute zero.","panel":{"kind":"bars","title":"Per-pattern normalized entropy contributions","a":[0.1842297314937375,0.1052061385525881],"a_label":"x entropy terms","b":[0.20522912072582364,0.15514759035738454],"b_label":"y entropy terms","labels":["012","021"],"marker":1},"value":0.2894358700463256,"value_label":"partial H(x)"},{"phase":2,"caption":"Accumulate the stated distribution functional; zero-mass terms contribute zero.","panel":{"kind":"bars","title":"Per-pattern normalized entropy contributions","a":[0.1842297314937375,0.1052061385525881,0.1052061385525881],"a_label":"x entropy terms","b":[0.20522912072582364,0.15514759035738454,0.1052061385525881],"b_label":"y entropy terms","labels":["012","021","102"],"marker":2},"value":0.3946420085989137,"value_label":"partial H(x)"},{"phase":2,"caption":"Accumulate the stated distribution functional; zero-mass terms contribute zero.","panel":{"kind":"bars","title":"Per-pattern normalized entropy contributions","a":[0.1842297314937375,0.1052061385525881,0.1052061385525881,0.1052061385525881],"a_label":"x entropy terms","b":[0.20522912072582364,0.15514759035738454,0.1052061385525881,0.0],"b_label":"y entropy terms","labels":["012","021","102","120"],"marker":3},"value":0.4998481471515018,"value_label":"partial H(x)"},{"phase":2,"caption":"Accumulate the stated distribution functional; zero-mass terms contribute zero.","panel":{"kind":"bars","title":"Per-pattern normalized entropy contributions","a":[0.1842297314937375,0.1052061385525881,0.1052061385525881,0.1052061385525881,0.1052061385525881],"a_label":"x entropy terms","b":[0.20522912072582364,0.15514759035738454,0.1052061385525881,0.0,0.0],"b_label":"y entropy terms","labels":["012","021","102","120","201"],"marker":4},"value":0.6050542857040899,"value_label":"partial H(x)"},{"phase":2,"caption":"Accumulate the stated distribution functional; zero-mass terms contribute zero.","panel":{"kind":"bars","title":"Per-pattern normalized entropy contributions","a":[0.1842297314937375,0.1052061385525881,0.1052061385525881,0.1052061385525881,0.1052061385525881,0.1934264036172708],"a_label":"x entropy terms","b":[0.20522912072582364,0.15514759035738454,0.1052061385525881,0.0,0.0,0.20266540274410003],"b_label":"y entropy terms","labels":["012","021","102","120","201","210"],"marker":5},"value":0.7984806893213607,"value_label":"partial H(x)"},{"phase":3,"caption":"Compare only two scalar entropies; pattern identities have been compressed.","panel":{"kind":"bars","title":"Normalized entropies; compare their absolute difference","a":[0.7984806893213608,0.6682482523798964],"a_label":"entropy","labels":["H(x)","H(y)"],"marker":0},"value":0.13023243694146447,"value_label":"final distance"},{"phase":3,"caption":"Compare only two scalar entropies; pattern identities have been compressed.","panel":{"kind":"bars","title":"Normalized entropies; compare their absolute difference","a":[0.7984806893213608,0.6682482523798964],"a_label":"entropy","labels":["H(x)","H(y)"],"marker":1},"value":0.13023243694146447,"value_label":"final distance"},{"phase":3,"caption":"Compare only two scalar entropies; pattern identities have been compressed.","panel":{"kind":"bars","title":"Normalized entropies; compare their absolute difference","a":[0.7984806893213608,0.6682482523798964],"a_label":"entropy","labels":["H(x)","H(y)"],"marker":0},"value":0.13023243694146447,"value_label":"final distance"},{"phase":3,"caption":"Compare only two scalar entropies; pattern identities have been compressed.","panel":{"kind":"bars","title":"Normalized entropies; compare their absolute difference","a":[0.7984806893213608,0.6682482523798964],"a_label":"entropy","labels":["H(x)","H(y)"],"marker":1},"value":0.13023243694146447,"value_label":"final distance"}],"animation_steps_en":["Form overlapping three-point windows with delay one.","Rank each window; count all six patterns with a fixed tie policy.","Compute normalized Shannon entropy for each pattern distribution.","Take the absolute entropy difference; pattern identities are discarded."],"echotime_status":"Possible addition","echotime_api":""}
