{"id":"shift_mae_distance","title":"Shifted MAE","family":"sliding","definition":"reference","intro_en":"Shifted MAE evaluates mean absolute overlap error after each permitted integer shift, using only samples that overlap. This example admits lags from minus three to plus three samples, leaving at least seven paired observations. The animation shows the actual overlap pairs and candidate scores before selecting their minimum.","intro_zh":"Shifted MAE 在每个允许的整数平移后，仅对重叠样本计算对应分数。本例滞后范围为 −3 至 +3 个采样点，始终保留至少七对观测。动图展示实际配对和候选分数，再选择最小值。","steps_en":["Fix the permitted lags and minimum acceptable overlap before scoring.","At each lag, compute mean absolute overlap error on the actual paired samples.","Record every candidate score together with its lag.","Choose the minimum overlap score."],"steps_zh":["先固定允许滞后与最小可接受重叠长度。","对每个滞后的实际配对样本计算对应分数。","记录所有候选分数及其滞后。","选取最小重叠分数。"],"formula":"min_{lag=-3,...,3} mean(abs(x_overlap-y_overlap))","caveats_en":["Per-overlap averaging does not guarantee a stable estimate on very short overlaps.","The bounded window is an explicit demonstration choice; allowing every possible lag changes the problem.","Overlap cropping removes unmatched endpoints from this score."],"caveats_zh":["对重叠片段求平均不能保证短片段上的估计稳定。","有界窗口是明确的演示选择；允许所有滞后会改变问题。","重叠裁剪会从分数中排除未匹配的两端。"],"sources":[{"label":"Imported registry: overlap-based shift definitions","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/data/ts_similarity_package_v2_registry.csv"},{"label":"SciPy: cityblock","url":"https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cityblock.html"}],"x":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"y":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"input_label":"Deterministic synthetic illustration; sample index is the time axis.","parameters":{"lags":[-3,-2,-1,0,1,2,3],"minimum_overlap":7,"normalization":"none beyond stated mean/root","selected_lag":-2},"result":{"label":"distance","value":0.019140086376147933,"detail":""},"frames":[{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705],"b_label":"y"}},{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8,3.1,2.4],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623],"b_label":"y"}},{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323],"b_label":"y"}},{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"b_label":"y"}},{"phase":1,"caption":"Lag -3: mean absolute overlap error","panel":{"kind":"alignment","title":"Overlap correspondence at lag -3","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,3],[1,4],[2,5],[3,6],[4,7],[5,8],[6,9]]},"value":0.6320167816122314,"value_label":"current overlap score"},{"phase":1,"caption":"Lag -2: mean absolute overlap error","panel":{"kind":"alignment","title":"Overlap correspondence at lag -2","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,2],[1,3],[2,4],[3,5],[4,6],[5,7],[6,8],[7,9]]},"value":0.019140086376147933,"value_label":"current overlap score"},{"phase":1,"caption":"Lag -1: mean absolute overlap error","panel":{"kind":"alignment","title":"Overlap correspondence at lag -1","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9]]},"value":0.5174389760196285,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +0: mean absolute overlap error","panel":{"kind":"alignment","title":"Overlap correspondence at lag +0","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9]]},"value":0.7606462525088182,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +1: mean absolute overlap error","panel":{"kind":"alignment","title":"Overlap correspondence at lag +1","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[1,0],[2,1],[3,2],[4,3],[5,4],[6,5],[7,6],[8,7],[9,8]]},"value":0.9859353255474398,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +2: mean absolute overlap error","panel":{"kind":"alignment","title":"Overlap correspondence at lag +2","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[2,0],[3,1],[4,2],[5,3],[6,4],[7,5],[8,6],[9,7]]},"value":1.1503873346657076,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +3: mean absolute overlap error","panel":{"kind":"alignment","title":"Overlap correspondence at lag +3","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[3,0],[4,1],[5,2],[6,3],[7,4],[8,5],[9,6]]},"value":1.1845508971210985,"value_label":"current overlap score"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.6320167816122314],"a_label":"overlap score","marker":0,"x":[-3.0]},"value":0.6320167816122314,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.6320167816122314,0.019140086376147933],"a_label":"overlap score","marker":1,"x":[-3.0,-2.0]},"value":0.019140086376147933,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285],"a_label":"overlap score","marker":2,"x":[-3.0,-2.0,-1.0]},"value":0.019140086376147933,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182],"a_label":"overlap score","marker":3,"x":[-3.0,-2.0,-1.0,0.0]},"value":0.019140086376147933,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182,0.9859353255474398],"a_label":"overlap score","marker":4,"x":[-3.0,-2.0,-1.0,0.0,1.0]},"value":0.019140086376147933,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182,0.9859353255474398,1.1503873346657076],"a_label":"overlap score","marker":5,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0]},"value":0.019140086376147933,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182,0.9859353255474398,1.1503873346657076,1.1845508971210985],"a_label":"overlap score","marker":6,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.019140086376147933,"value_label":"best candidate so far"},{"phase":3,"caption":"Select the smallest overlap error","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182,0.9859353255474398,1.1503873346657076,1.1845508971210985],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.019140086376147933,"value_label":"final result"},{"phase":3,"caption":"Select the smallest overlap error","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182,0.9859353255474398,1.1503873346657076,1.1845508971210985],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.019140086376147933,"value_label":"final result"},{"phase":3,"caption":"Select the smallest overlap error","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182,0.9859353255474398,1.1503873346657076,1.1845508971210985],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.019140086376147933,"value_label":"final result"},{"phase":3,"caption":"Select the smallest overlap error","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.6320167816122314,0.019140086376147933,0.5174389760196285,0.7606462525088182,0.9859353255474398,1.1503873346657076,1.1845508971210985],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.019140086376147933,"value_label":"final result"}],"animation_steps_en":["Fix lags from -3 to +3 and retain adequate overlap.","Compute MAE on each actual overlap.","Record every candidate score with its lag.","Choose the minimum overlap error."],"echotime_status":"Possible addition","echotime_api":""}
