{"id":"sax_hamming_distance","title":"SAX Hamming distance","family":"feature-based","definition":"reference","intro_en":"Convert each standardized series to a four-symbol SAX word, then count the fraction of positions with different symbols. This treats every mismatch equally, including adjacent bins; it is a distance between words, with information lost during aggregation and quantization.","intro_zh":"把每条标准化序列转换为四符号 SAX 单词，再统计对应位置符号不同的比例。所有不匹配均等计数，包括相邻区间；它比较符号单词，聚合和量化已经损失信息。","steps_en":["Z-normalize each complete series and use four equal PAA blocks.","Quantize each mean with shared standard-normal quartile breakpoints.","Count mismatching symbols.","Divide the mismatch count by four."],"steps_zh":["对各完整序列做 z 标准化，并计算四个等长 PAA 区间。","使用共享标准正态四分位断点量化各区间均值。","统计符号不匹配数。","将不匹配数除以四。"],"formula":"d = sum_i [SAX_i(x) != SAX_i(y)] / 4","caveats_en":["Gaussian breakpoints are a coding convention; they do not make arbitrary observed signals normally distributed.","Hamming on words does not have the SAX Euclidean lower-bound interpretation.","Both PAA aggregation and quantization can map distinct signals to the same code."],"caveats_zh":["高斯断点是一种编码约定，不会使任意观测信号变成正态分布。","单词上的 Hamming 距离不具有 SAX 欧氏下界的含义。","PAA 聚合和量化都可能把不同信号映射为相同代码。"],"sources":[{"label":"Lin et al. (2007), Experiencing SAX, author copy","url":"https://www.cs.ucr.edu/~stelo/papers/DMKD07b.pdf"},{"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":{"length":16,"word_length":4,"alphabet_size":4,"breakpoints":[-0.6744897501960817,0.0,0.6744897501960817],"z_normalization_ddof":0,"x_word":"cadb","y_word":"bbcc"},"result":{"label":"word distance","value":1.0,"detail":"Normalized symbol mismatch rate"},"frames":[{"phase":0,"caption":"Standardize each full sequence to mean zero and population variance one.","panel":{"kind":"lines","title":"Z-normalized sequences","a":[-0.6144265168604166,0.8223839917095805,0.7118735976495486,0.6740604657545454],"a_label":"z(x)","b":[-1.1361741175234368,-0.42178022536415644,0.2926136667951239,1.0984825649593963],"b_label":"z(y)"},"input_highlight":[0,1,2,3]},{"phase":0,"caption":"Standardize each full sequence to mean zero and population variance one.","panel":{"kind":"lines","title":"Z-normalized sequences","a":[-0.6144265168604166,0.8223839917095805,0.7118735976495486,0.6740604657545454,0.025438222582952426,-1.5596958119420803,-1.5975089438370838,-0.7715075465436764],"a_label":"z(x)","b":[-1.1361741175234368,-0.42178022536415644,0.2926136667951239,1.0984825649593963,1.0898246422086943,-0.16222316360159827,-1.4142709694118916,-1.4229288921625938],"b_label":"z(y)"},"input_highlight":[0,1,2,3,4,5,6,7]},{"phase":0,"caption":"Standardize each full sequence to mean zero and population variance one.","panel":{"kind":"lines","title":"Z-normalized sequences","a":[-0.6144265168604166,0.8223839917095805,0.7118735976495486,0.6740604657545454,0.025438222582952426,-1.5596958119420803,-1.5975089438370838,-0.7715075465436764,-0.2712088293271185,1.1656016792428783,1.9916030765362855,1.017278153287845],"a_label":"z(x)","b":[-1.1361741175234368,-0.42178022536415644,0.2926136667951239,1.0984825649593963,1.0898246422086943,-0.16222316360159827,-1.4142709694118916,-1.4229288921625938,-0.6170599939983212,0.09733389816095916,0.8117277903202393,1.6175966884845112],"b_label":"z(y)"},"input_highlight":[0,1,2,3,4,5,6,7,8,9,10,11]},{"phase":0,"caption":"Standardize each full sequence to mean zero and population variance one.","panel":{"kind":"lines","title":"Z-normalized sequences","a":[-0.6144265168604166,0.8223839917095805,0.7118735976495486,0.6740604657545454,0.025438222582952426,-1.5596958119420803,-1.5975089438370838,-0.7715075465436764,-0.2712088293271185,1.1656016792428783,1.9916030765362855,1.017278153287845,0.3686559101162506,-0.27996633305534346,-1.2542912563037847,-0.4282898590103812],"a_label":"z(x)","b":[-1.1361741175234368,-0.42178022536415644,0.2926136667951239,1.0984825649593963,1.0898246422086943,-0.16222316360159827,-1.4142709694118916,-1.4229288921625938,-0.6170599939983212,0.09733389816095916,0.8117277903202393,1.6175966884845112,1.6089387657338112,0.35689095992351744,-0.8951568458867762,-0.9038147686374788],"b_label":"z(y)"},"input_highlight":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]},{"phase":1,"caption":"Average block 1, then locate its mean among Gaussian breakpoints.","panel":{"kind":"bars","title":"PAA values before symbolization","a":[0.3984728845633145],"a_label":"x features","b":[-0.04171452778326823],"b_label":"y features","labels":["block 1"],"marker":0},"input_highlight":[0,1,2,3]},{"phase":1,"caption":"Average block 2, then locate its mean among Gaussian breakpoints.","panel":{"kind":"bars","title":"PAA values before symbolization","a":[0.3984728845633145,-0.9758185199349719],"a_label":"x features","b":[-0.04171452778326823,-0.4773995957418473],"b_label":"y features","labels":["block 1","block 2"],"marker":1},"input_highlight":[4,5,6,7]},{"phase":1,"caption":"Average block 3, then locate its mean among Gaussian breakpoints.","panel":{"kind":"bars","title":"PAA values before symbolization","a":[0.3984728845633145,-0.9758185199349719,0.9758185199349725],"a_label":"x features","b":[-0.04171452778326823,-0.4773995957418473,0.4773995957418471],"b_label":"y features","labels":["block 1","block 2","block 3"],"marker":2},"input_highlight":[8,9,10,11]},{"phase":1,"caption":"Average block 4, then locate its mean among Gaussian breakpoints.","panel":{"kind":"bars","title":"PAA values before symbolization","a":[0.3984728845633145,-0.9758185199349719,0.9758185199349725,-0.3984728845633147],"a_label":"x features","b":[-0.04171452778326823,-0.4773995957418473,0.4773995957418471,0.041714527783268424],"b_label":"y features","labels":["block 1","block 2","block 3","block 4"],"marker":3},"input_highlight":[12,13,14,15]},{"phase":1,"caption":"Encode bins by a=0, b=1, c=2, d=3; their numeric codes are not distances.","panel":{"kind":"bars","title":"SAX symbol codes (not numeric distances)","a":[2.0],"a_label":"x symbols","b":[1.0],"b_label":"y symbols","labels":["1: c/b"],"marker":0}},{"phase":1,"caption":"Encode bins by a=0, b=1, c=2, d=3; their numeric codes are not distances.","panel":{"kind":"bars","title":"SAX symbol codes (not numeric distances)","a":[2.0,0.0],"a_label":"x symbols","b":[1.0,1.0],"b_label":"y symbols","labels":["1: c/b","2: a/b"],"marker":1}},{"phase":1,"caption":"Encode bins by a=0, b=1, c=2, d=3; their numeric codes are not distances.","panel":{"kind":"bars","title":"SAX symbol codes (not numeric distances)","a":[2.0,0.0,3.0],"a_label":"x symbols","b":[1.0,1.0,2.0],"b_label":"y symbols","labels":["1: c/b","2: a/b","3: d/c"],"marker":2}},{"phase":1,"caption":"Encode bins by a=0, b=1, c=2, d=3; their numeric codes are not distances.","panel":{"kind":"bars","title":"SAX symbol codes (not numeric distances)","a":[2.0,0.0,3.0,1.0],"a_label":"x symbols","b":[1.0,1.0,2.0,2.0],"b_label":"y symbols","labels":["1: c/b","2: a/b","3: d/c","4: b/c"],"marker":3}},{"phase":2,"caption":"Count unequal symbols with equal weight.","panel":{"kind":"bars","title":"Mismatch contributions / word length","a":[0.25],"a_label":"contributions","labels":["1: c/b"],"marker":0},"value":0.25,"value_label":"partial dissimilarity"},{"phase":2,"caption":"Count unequal symbols with equal weight.","panel":{"kind":"bars","title":"Mismatch contributions / word length","a":[0.25,0.25],"a_label":"contributions","labels":["1: c/b","2: a/b"],"marker":1},"value":0.5,"value_label":"partial dissimilarity"},{"phase":2,"caption":"Count unequal symbols with equal weight.","panel":{"kind":"bars","title":"Mismatch contributions / word length","a":[0.25,0.25,0.25],"a_label":"contributions","labels":["1: c/b","2: a/b","3: d/c"],"marker":2},"value":0.75,"value_label":"partial dissimilarity"},{"phase":2,"caption":"Count unequal symbols with equal weight.","panel":{"kind":"bars","title":"Mismatch contributions / word length","a":[0.25,0.25,0.25,0.25],"a_label":"contributions","labels":["1: c/b","2: a/b","3: d/c","4: b/c"],"marker":3},"value":1.0,"value_label":"partial dissimilarity"},{"phase":3,"caption":"Hamming counts every symbol mismatch equally.","panel":{"kind":"bars","title":"Final SAX comparison contributions","a":[0.25,0.25,0.25,0.25],"a_label":"contributions","labels":["1: c/b","2: a/b","3: d/c","4: b/c"],"marker":0},"value":1.0,"value_label":"final dissimilarity"},{"phase":3,"caption":"Hamming counts every symbol mismatch equally.","panel":{"kind":"bars","title":"Final SAX comparison contributions","a":[0.25,0.25,0.25,0.25],"a_label":"contributions","labels":["1: c/b","2: a/b","3: d/c","4: b/c"],"marker":1},"value":1.0,"value_label":"final dissimilarity"},{"phase":3,"caption":"Hamming counts every symbol mismatch equally.","panel":{"kind":"bars","title":"Final SAX comparison contributions","a":[0.25,0.25,0.25,0.25],"a_label":"contributions","labels":["1: c/b","2: a/b","3: d/c","4: b/c"],"marker":2},"value":1.0,"value_label":"final dissimilarity"},{"phase":3,"caption":"Hamming counts every symbol mismatch equally.","panel":{"kind":"bars","title":"Final SAX comparison contributions","a":[0.25,0.25,0.25,0.25],"a_label":"contributions","labels":["1: c/b","2: a/b","3: d/c","4: b/c"],"marker":3},"value":1.0,"value_label":"final dissimilarity"}],"animation_steps_en":["Z-normalize each input and average four equal blocks.","Quantize block means with shared Gaussian quartile breakpoints.","Count positions with different symbols, including adjacent bins.","Divide the mismatch count by the word length of four."],"echotime_status":"Possible addition","echotime_api":""}
