{"id":"markov_distance","title":"Discretized Markov-transition distance","family":"model-based","definition":"protocol","intro_en":"Map observations to three shared value states and count consecutive state transitions. Row-normalized count matrices describe the next-state distribution conditional on the current state. Compare these matrices by Frobenius distance. This illustrates a specified first-order discretization, without establishing that either signal is generated by a Markov chain.","intro_zh":"把观测映射到三个共享数值状态，统计连续状态转移。按行归一化的计数矩阵描述给定当前状态时的下一状态分布，再以 Frobenius 距离比较两个矩阵。这只是指定的一阶离散化示例，并未证明信号由 Markov 链生成。","steps_en":["Use shared thresholds 0 and 0.7, then count consecutive transitions between the three states.","Divide each row by its outgoing-transition count; every row is observed in this example.","Square differences between corresponding conditional transition probabilities.","Sum these squared differences and take their square root, giving the Frobenius norm."],"steps_zh":["用共享阈值 0 和 0.7 定义三个状态，再统计连续转移。","用各行转出总数进行归一化；本例每行均有观测。","对相对应的条件转移概率计算差的平方。","累加这些平方差并开平方，得到 Frobenius 范数。"],"formula":"P_ij = count(s_t=i,s_(t+1)=j) / count(s_t=i); d=||P_x-P_y||_F","caveats_en":["State boundaries and sampling interval define the estimated transitions; independently chosen bins would not have matching meanings.","Unobserved rows need a documented smoothing or missing-row policy. No smoothing is used here because every row has observations.","First-order transition matrices discard longer history and do not prove causal equivalence or equal state occupancy."],"caveats_zh":["状态边界和采样间隔决定转移估计；分别选取的分箱可能不具有对应含义。","未观测行需要明确平滑或缺失规则。本例每行均有观测，因此不平滑。","一阶转移矩阵舍弃更长历史，也不能证明因果等价或状态占比相同。"],"sources":[{"label":"Imported registry: named feature and comparison conventions","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/data/ts_similarity_package_v2_registry.csv"},{"label":"Exact illustrative inputs and encoder definitions","url":"https://github.com/ZipengWu365/EchoTime/blob/main/tools/method_animation_data/feature_model_embedding.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":{"state_thresholds":[0.0,0.7],"order":1,"smoothing":0,"unobserved_rows":"not present in this example","P_x":[[0.5,0.5,0.0],[0.4,0.2,0.4],[0.0,0.3333333333333333,0.6666666666666666]],"P_y":[[0.5,0.5,0.0],[0.3333333333333333,0.3333333333333333,0.3333333333333333],[0.0,0.4,0.6]]},"result":{"label":"distance","value":0.1885618083164127,"detail":"Frobenius norm on conditional transition probabilities; rows unweighted."},"frames":[{"phase":0,"caption":"Count the first 1 transitions using shared low/middle/high states.","panel":{"kind":"matrix","title":"Transition counts: x (left) | y (right)","z":[[0.0,0.0,0.0,0.0,1.0,0.0],[0.0,0.0,1.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0,0.0,0.0]],"row_label":"current state","col_label":"x next state | y next state","cursor":[1,2]},"input_highlight":[0,1]},{"phase":0,"caption":"Count the first 3 transitions using shared low/middle/high states.","panel":{"kind":"matrix","title":"Transition counts: x (left) | y (right)","z":[[0.0,0.0,0.0,0.0,1.0,0.0],[0.0,0.0,1.0,0.0,1.0,1.0],[0.0,0.0,2.0,0.0,0.0,0.0]],"row_label":"current state","col_label":"x next state | y next state","cursor":[2,2]},"input_highlight":[2,3]},{"phase":0,"caption":"Count the first 6 transitions using shared low/middle/high states.","panel":{"kind":"matrix","title":"Transition counts: x (left) | y (right)","z":[[1.0,0.0,0.0,0.0,1.0,0.0],[1.0,0.0,1.0,1.0,1.0,1.0],[0.0,1.0,2.0,0.0,1.0,1.0]],"row_label":"current state","col_label":"x next state | y next state","cursor":[0,0]},"input_highlight":[5,6]},{"phase":0,"caption":"Count the first 9 transitions using shared low/middle/high states.","panel":{"kind":"matrix","title":"Transition counts: x (left) | y (right)","z":[[2.0,1.0,0.0,1.0,2.0,0.0],[1.0,0.0,2.0,1.0,2.0,1.0],[0.0,1.0,2.0,0.0,1.0,1.0]],"row_label":"current state","col_label":"x next state | y next state","cursor":[1,2]},"input_highlight":[8,9]},{"phase":0,"caption":"Count the first 12 transitions using shared low/middle/high states.","panel":{"kind":"matrix","title":"Transition counts: x (left) | y (right)","z":[[2.0,1.0,0.0,1.0,2.0,0.0],[1.0,0.0,2.0,1.0,2.0,2.0],[0.0,2.0,4.0,0.0,1.0,3.0]],"row_label":"current state","col_label":"x next state | y next state","cursor":[2,1]},"input_highlight":[11,12]},{"phase":0,"caption":"Count the first 15 transitions using shared low/middle/high states.","panel":{"kind":"matrix","title":"Transition counts: x (left) | y (right)","z":[[2.0,2.0,0.0,2.0,2.0,0.0],[2.0,1.0,2.0,2.0,2.0,2.0],[0.0,2.0,4.0,0.0,2.0,3.0]],"row_label":"current state","col_label":"x next state | y next state","cursor":[0,1]},"input_highlight":[14,15]},{"phase":1,"caption":"Normalize each series' transition counts by its own outgoing row total.","panel":{"kind":"matrix","title":"Transition probabilities: x (left) | y (right)","z":[[0.5,0.5,0.0,0.5,0.5,0.0],[0.4,0.2,0.4,0.3333333333333333,0.3333333333333333,0.3333333333333333],[0.0,0.3333333333333333,0.6666666666666666,0.0,0.4,0.6]],"row_label":"current state","col_label":"x next state | y next state","cursor":[0,0]},"value":0.5,"value_label":"x stay probability"},{"phase":1,"caption":"Normalize each series' transition counts by its own outgoing row total.","panel":{"kind":"matrix","title":"Transition probabilities: x (left) | y (right)","z":[[0.5,0.5,0.0,0.5,0.5,0.0],[0.4,0.2,0.4,0.3333333333333333,0.3333333333333333,0.3333333333333333],[0.0,0.3333333333333333,0.6666666666666666,0.0,0.4,0.6]],"row_label":"current state","col_label":"x next state | y next state","cursor":[1,1]},"value":0.2,"value_label":"x stay probability"},{"phase":1,"caption":"Normalize each series' transition counts by its own outgoing row total.","panel":{"kind":"matrix","title":"Transition probabilities: x (left) | y (right)","z":[[0.5,0.5,0.0,0.5,0.5,0.0],[0.4,0.2,0.4,0.3333333333333333,0.3333333333333333,0.3333333333333333],[0.0,0.3333333333333333,0.6666666666666666,0.0,0.4,0.6]],"row_label":"current state","col_label":"x next state | y next state","cursor":[2,2]},"value":0.6666666666666666,"value_label":"x stay probability"},{"phase":1,"caption":"Normalize each series' transition counts by its own outgoing row total.","panel":{"kind":"matrix","title":"Transition probabilities: x (left) | y (right)","z":[[0.5,0.5,0.0,0.5,0.5,0.0],[0.4,0.2,0.4,0.3333333333333333,0.3333333333333333,0.3333333333333333],[0.0,0.3333333333333333,0.6666666666666666,0.0,0.4,0.6]],"row_label":"current state","col_label":"x next state | y next state","cursor":[0,0]},"value":0.5,"value_label":"x stay probability"},{"phase":1,"caption":"Normalize each series' transition counts by its own outgoing row total.","panel":{"kind":"matrix","title":"Transition probabilities: x (left) | y (right)","z":[[0.5,0.5,0.0,0.5,0.5,0.0],[0.4,0.2,0.4,0.3333333333333333,0.3333333333333333,0.3333333333333333],[0.0,0.3333333333333333,0.6666666666666666,0.0,0.4,0.6]],"row_label":"current state","col_label":"x next state | y next state","cursor":[1,1]},"value":0.2,"value_label":"x stay probability"},{"phase":1,"caption":"Normalize each series' transition counts by its own outgoing row total.","panel":{"kind":"matrix","title":"Transition probabilities: x (left) | y (right)","z":[[0.5,0.5,0.0,0.5,0.5,0.0],[0.4,0.2,0.4,0.3333333333333333,0.3333333333333333,0.3333333333333333],[0.0,0.3333333333333333,0.6666666666666666,0.0,0.4,0.6]],"row_label":"current state","col_label":"x next state | y next state","cursor":[2,2]},"value":0.6666666666666666,"value_label":"x stay probability"},{"phase":2,"caption":"Compare corresponding conditional transition probabilities.","panel":{"kind":"bars","title":"Squared transition-probability differences","a":[0.0],"a_label":"contributions","labels":["0->0"],"marker":0},"value":0.0,"value_label":"partial Frobenius norm"},{"phase":2,"caption":"Compare corresponding conditional transition probabilities.","panel":{"kind":"bars","title":"Squared transition-probability differences","a":[0.0,0.0,0.0],"a_label":"contributions","labels":["0->0","0->1","0->2"],"marker":2},"value":0.0,"value_label":"partial Frobenius norm"},{"phase":2,"caption":"Compare corresponding conditional transition probabilities.","panel":{"kind":"bars","title":"Squared transition-probability differences","a":[0.0,0.0,0.0,0.00444444444444445],"a_label":"contributions","labels":["0->0","0->1","0->2","1->0"],"marker":3},"value":0.06666666666666671,"value_label":"partial Frobenius norm"},{"phase":2,"caption":"Compare corresponding conditional transition probabilities.","panel":{"kind":"bars","title":"Squared transition-probability differences","a":[0.0,0.0,0.0,0.00444444444444445,0.01777777777777777,0.00444444444444445],"a_label":"contributions","labels":["0->0","0->1","0->2","1->0","1->1","1->2"],"marker":5},"value":0.16329931618554522,"value_label":"partial Frobenius norm"},{"phase":2,"caption":"Compare corresponding conditional transition probabilities.","panel":{"kind":"bars","title":"Squared transition-probability differences","a":[0.0,0.0,0.0,0.00444444444444445,0.01777777777777777,0.00444444444444445,0.0,0.00444444444444445],"a_label":"contributions","labels":["0->0","0->1","0->2","1->0","1->1","1->2","2->0","2->1"],"marker":7},"value":0.17638342073763938,"value_label":"partial Frobenius norm"},{"phase":2,"caption":"Compare corresponding conditional transition probabilities.","panel":{"kind":"bars","title":"Squared transition-probability differences","a":[0.0,0.0,0.0,0.00444444444444445,0.01777777777777777,0.00444444444444445,0.0,0.00444444444444445,0.004444444444444443],"a_label":"contributions","labels":["0->0","0->1","0->2","1->0","1->1","1->2","2->0","2->1","2->2"],"marker":8},"value":0.1885618083164127,"value_label":"partial Frobenius norm"},{"phase":3,"caption":"Take the Frobenius norm of the complete transition-matrix difference.","panel":{"kind":"matrix","title":"Signed probability difference P_x - P_y","z":[[0.0,0.0,0.0],[0.06666666666666671,-0.1333333333333333,0.06666666666666671],[0.0,-0.06666666666666671,0.06666666666666665]],"row_label":"current state","col_label":"next state","cursor":[0,0]},"value":0.1885618083164127,"value_label":"final distance"},{"phase":3,"caption":"Take the Frobenius norm of the complete transition-matrix difference.","panel":{"kind":"matrix","title":"Signed probability difference P_x - P_y","z":[[0.0,0.0,0.0],[0.06666666666666671,-0.1333333333333333,0.06666666666666671],[0.0,-0.06666666666666671,0.06666666666666665]],"row_label":"current state","col_label":"next state","cursor":[1,1]},"value":0.1885618083164127,"value_label":"final distance"},{"phase":3,"caption":"Take the Frobenius norm of the complete transition-matrix difference.","panel":{"kind":"matrix","title":"Signed probability difference P_x - P_y","z":[[0.0,0.0,0.0],[0.06666666666666671,-0.1333333333333333,0.06666666666666671],[0.0,-0.06666666666666671,0.06666666666666665]],"row_label":"current state","col_label":"next state","cursor":[2,2]},"value":0.1885618083164127,"value_label":"final distance"},{"phase":3,"caption":"Take the Frobenius norm of the complete transition-matrix difference.","panel":{"kind":"matrix","title":"Signed probability difference P_x - P_y","z":[[0.0,0.0,0.0],[0.06666666666666671,-0.1333333333333333,0.06666666666666671],[0.0,-0.06666666666666671,0.06666666666666665]],"row_label":"current state","col_label":"next state","cursor":[0,0]},"value":0.1885618083164127,"value_label":"final distance"}],"animation_steps_en":["Bin both inputs with thresholds 0 and 0.7, then count state transitions.","Normalize each row by its outgoing-transition count.","Square differences between corresponding transition probabilities.","Sum squared differences and take the square root."],"echotime_status":"Possible addition","echotime_api":""}
