{"id":"acf_embedding_similarity","title":"Autocorrelation features embedding similarity","family":"embedding","definition":"reference","intro_en":"Center each series and compare it with delayed versions of itself. Six lag coordinates summarize repeated linear dependence. This example follows EchoTime's adjusted denominator, (n-lag) times the population variance, and omits the always-one lag-zero coordinate. Cosine compares vector direction and is defined here for nonzero feature vectors.","intro_zh":"先对序列去均值，再与自身的延迟版本比较。六个滞后坐标描述重复出现的线性依赖。本例采用 EchoTime 的调整分母，即 (n-lag) 乘总体方差，并省略恒为一的零滞后坐标。 余弦比较向量方向，本例特征向量均非零。","steps_en":["At each lag, sum centered lagged products and divide by (n-lag) times variance.","Collect the computed coordinates in the same fixed order for both inputs.","Normalize by both vector lengths and sum coordinate products to obtain cosine similarity.","Interpret the score in this representation, accounting for the information it discards."],"steps_zh":["逐个滞后累加去均值后的乘积，除以 (n-lag) 乘方差。","把计算得到的坐标按同一个固定顺序组成两个向量。","用两个向量的长度归一化坐标乘积之和，得到余弦相似度。","结合表示所舍弃的信息，在该表示空间中解释分数。"],"animation_steps_en":["Compute centered lag products at lags 1 to 6, with adjusted denominators.","Collect matching coordinates in the same vector order.","Normalize vector products to obtain cosine similarity.","Read the score in this feature space, with its stated information loss."],"formula":"s(x,y) = dot(phi(x),phi(y)) / (norm(phi(x))*norm(phi(y)))","caveats_en":["Adjusted high-lag sample estimates need not remain inside [-1,1]; estimates are less reliable with fewer overlapping pairs.","ACF drops the mean and amplitude scale and cannot fully identify nonlinear dependence or the original waveform.","Cosine ignores positive rescaling of the entire feature vector; 1-cosine is generally not a metric, and zero vectors require an explicit policy."],"caveats_zh":["经过样本数调整的高滞后估计不一定落在 [-1,1]，重叠点越少估计越不稳定。","ACF 舍弃均值和振幅尺度，无法完整识别非线性依赖或恢复原波形。","余弦忽略整个特征向量的正比例缩放；1-cosine 通常不满足度量公理，零向量还需明确处理规则。"],"sources":[{"label":"EchoTime low-level implementation","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/similarity_methods.py"},{"label":"statsmodels: ACF denominator and adjusted convention","url":"https://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.acf.html"},{"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],"input_label":"Deterministic synthetic teaching signals, 16 samples each","parameters":{"max_lag":6,"denominator":"(n-lag)*population_variance","lag_zero":"omitted","comparison":"cosine"},"result":{"label":"similarity","value":0.9714491332590095,"detail":"Computed from the explicitly defined illustrative encoder; no learned weights."},"frames":[{"phase":0,"caption":"Lag 1: sum centered products, then divide by (n-lag) times variance.","panel":{"kind":"lines","title":"Lag-1 centered products","a":[-0.18822063446267598,0.2180721315406135,0.17874107963699554,0.006387166743556502,-0.014779144789257556,0.9281236496029575,0.45909875137943323,0.07794111913269876,-0.11775425885351315,0.8647201670748005,0.7546839974046686,0.1396958657029466,-0.038445865702946266,0.13080575102411574,0.20010540571959068],"a_label":"x products","b":[0.13941884453995465,-0.03590634453995467,0.09351432588977204,0.348289325889772,-0.05143513251536707,0.06674763251536703,0.5854720909205064,0.2554470909205065,-0.017473579509220308,0.0229860795092203,0.38200674993894673,0.7571817499389473,0.16705729153380813,-0.09294479153380794,0.23537966687133172],"b_label":"y products"},"value":0.6441530856634482,"value_label":"x ACF(1)","input_highlight":[0,1]},{"phase":0,"caption":"Lag 2: sum centered products, then divide by (n-lag) times variance.","panel":{"kind":"lines","title":"Lag-2 centered products","a":[-0.16292790418778383,0.20648862809309673,0.0067454710660613424,-0.39161687447364846,-0.015137449111762399,0.4482318565769261,0.16138744911176198,-0.3349754488765786,-0.20120058883257635,0.44168486433676335,0.27349325748733005,-0.10608846404093408,-0.17224325748732985,0.04466488655031893],"a_label":"x products","b":[-0.09672302509192592,-0.13479374999999996,0.09277727294467816,-0.051843749999999876,-0.4484144749080741,0.06715624999999985,0.2538928030061469,-0.040293749999999996,-0.14572302509192592,0.045806249999999965,0.3799621210430284,0.1679562500000001,-0.4190144749080746,-0.09384375000000018],"b_label":"y products"},"value":0.03806483049162021,"value_label":"x ACF(2)","input_highlight":[0,2]},{"phase":0,"caption":"Lag 3: sum centered products, then divide by (n-lag) times variance.","panel":{"kind":"lines","title":"Lag-3 centered products","a":[-0.1542735386504598,0.007792629814597991,-0.41358561656595405,-0.40111120049119564,-0.00731054199740153,0.15756739857432753,-0.6936112004911954,-0.5723551590797807,-0.10276995745758541,0.16006412319027608,-0.20769748243000824,-0.4752922659987756,-0.058814123190276346],"a_label":"x products","b":[-0.36310182588977197,-0.13373134453995467,-0.013810132515367151,-0.451976825889772,-0.4511595909205065,0.02912263251536712,-0.0400485795092203,-0.3360345909205064,-0.2903942499389469,0.045561079509220344,0.08428229153380788,-0.42126924993894693,-0.4230671668713321],"b_label":"y products"},"value":-0.5702467926935431,"value_label":"x ACF(3)","input_highlight":[0,3]},{"phase":0,"caption":"Lag 4: sum centered products, then divide by (n-lag) times variance.","panel":{"kind":"lines","title":"Lag-4 centered products","a":[-0.005822095812216306,-0.47779014615544085,-0.42361255088823807,-0.1937142946059839,-0.0025698822334847505,-0.677193382043789,-1.185137449111762,-0.29234961831152906,-0.03724325748732974,-0.12155661795621106,-0.9305159421321219,-0.1622931329308717],"a_label":"x products","b":[-0.3602399620245875,0.019906249999999952,-0.12039753797541251,-0.45474375,-0.19564753797541257,-0.0045937499999999885,-0.3339899620245874,-0.6696437499999996,-0.2888399620245878,0.01010625000000001,-0.21139753797541255,-0.4253437500000001],"b_label":"y products"},"value":-1.0089118997157445,"value_label":"x ACF(4)","input_highlight":[0,4]},{"phase":0,"caption":"Lag 5: sum centered products, then divide by (n-lag) times variance.","panel":{"kind":"lines","title":"Lag-5 centered products","a":[0.35697063446267585,-0.48937364960295765,-0.204581189408491,-0.06809658220374028,0.011044843393329543,-1.1570851750698201,-0.6053487513794344,-0.10594586570294628,0.028283442482925893,-0.5445919206942486,-0.3177336521001433],"a_label":"x products","b":[0.05362263251536706,0.17354384453995467,-0.12113459092050644,-0.19720182588977206,0.030861079509220308,-0.038310132515367086,-0.6655692499389466,-0.666059590920507,-0.06406979153380789,-0.025348579509220315,-0.21344216687133158],"b_label":"y products"},"value":-0.7557007528257913,"value_label":"x ACF(5)","input_highlight":[0,5]},{"phase":0,"caption":"Lag 6: sum centered products, then divide by (n-lag) times variance.","panel":{"kind":"lines","title":"Lag-6 centered products","a":[0.36562499999999987,-0.23634012517103398,-0.07191663274117471,0.2926655845398162,0.018871750507690414,-0.5910201103619976,-0.2193750000000003,0.0804578869056364,0.12671407385791691,-0.1859561690796334],"a_label":"x products","b":[0.4674852270553218,0.17460625,-0.052530601042750945,0.03110624999999999,0.2573696969938531,-0.07634374999999978,-0.6620068989572496,-0.1477437500000002,0.16070037895697198,-0.025593750000000016],"b_label":"y products"},"value":-0.11282611173901154,"value_label":"x ACF(6)","input_highlight":[0,6]},{"phase":1,"caption":"Expose 1 of 6 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.6441530856634482],"a_label":"x features","b":[0.6543907997438757],"b_label":"y features","labels":["lag 1"],"marker":0}},{"phase":1,"caption":"Expose 2 of 6 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.6441530856634482,0.03806483049162021],"a_label":"x features","b":[0.6543907997438757,-0.10387801561025331],"b_label":"y features","labels":["lag 1","lag 2"],"marker":1}},{"phase":1,"caption":"Expose 3 of 6 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.6441530856634482,0.03806483049162021,-0.5702467926935431],"a_label":"x features","b":[0.6543907997438757,-0.10387801561025331,-0.7312400473614216],"b_label":"y features","labels":["lag 1","lag 2","lag 3"],"marker":2}},{"phase":1,"caption":"Expose 4 of 6 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.6441530856634482,0.03806483049162021,-0.5702467926935431,-1.0089118997157445],"a_label":"x features","b":[0.6543907997438757,-0.10387801561025331,-0.7312400473614216,-0.8692846964130985],"b_label":"y features","labels":["lag 1","lag 2","lag 3","lag 4"],"marker":3}},{"phase":1,"caption":"Expose 5 of 6 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.6441530856634482,0.03806483049162021,-0.5702467926935431,-1.0089118997157445,-0.7557007528257913],"a_label":"x features","b":[0.6543907997438757,-0.10387801561025331,-0.7312400473614216,-0.8692846964130985,-0.5415551148361485],"b_label":"y features","labels":["lag 1","lag 2","lag 3","lag 4","lag 5"],"marker":4}},{"phase":1,"caption":"Expose 6 of 6 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.6441530856634482,0.03806483049162021,-0.5702467926935431,-1.0089118997157445,-0.7557007528257913,-0.11282611173901154],"a_label":"x features","b":[0.6543907997438757,-0.10387801561025331,-0.7312400473614216,-0.8692846964130985,-0.5415551148361485,0.04366978556141571],"b_label":"y features","labels":["lag 1","lag 2","lag 3","lag 4","lag 5","lag 6"],"marker":5}},{"phase":2,"caption":"Sum normalized dot-product contributions from the displayed coordinates.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184],"a_label":"contributions","labels":["lag 1"],"marker":0},"value":0.19352953571729184,"value_label":"partial dot sum"},{"phase":2,"caption":"Sum normalized dot-product contributions from the displayed coordinates.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212],"a_label":"contributions","labels":["lag 1","lag 2"],"marker":1},"value":0.19171415163471503,"value_label":"partial dot sum"},{"phase":2,"caption":"Sum normalized dot-product contributions from the displayed coordinates.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349],"a_label":"contributions","labels":["lag 1","lag 2","lag 3"],"marker":2},"value":0.3831590500200499,"value_label":"partial dot sum"},{"phase":2,"caption":"Sum normalized dot-product contributions from the displayed coordinates.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349,0.40265793020428964],"a_label":"contributions","labels":["lag 1","lag 2","lag 3","lag 4"],"marker":3},"value":0.7858169802243395,"value_label":"partial dot sum"},{"phase":2,"caption":"Sum normalized dot-product contributions from the displayed coordinates.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349,0.40265793020428964,0.1878942523029937],"a_label":"contributions","labels":["lag 1","lag 2","lag 3","lag 4","lag 5"],"marker":4},"value":0.9737112325273333,"value_label":"partial dot sum"},{"phase":2,"caption":"Sum normalized dot-product contributions from the displayed coordinates.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349,0.40265793020428964,0.1878942523029937,-0.0022620992683237812],"a_label":"contributions","labels":["lag 1","lag 2","lag 3","lag 4","lag 5","lag 6"],"marker":5},"value":0.9714491332590095,"value_label":"partial dot sum"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349,0.40265793020428964,0.1878942523029937,-0.0022620992683237812],"a_label":"contributions","labels":["lag 1","lag 2","lag 3","lag 4","lag 5","lag 6"],"marker":0},"value":0.9714491332590095,"value_label":"final similarity"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349,0.40265793020428964,0.1878942523029937,-0.0022620992683237812],"a_label":"contributions","labels":["lag 1","lag 2","lag 3","lag 4","lag 5","lag 6"],"marker":2},"value":0.9714491332590095,"value_label":"final similarity"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349,0.40265793020428964,0.1878942523029937,-0.0022620992683237812],"a_label":"contributions","labels":["lag 1","lag 2","lag 3","lag 4","lag 5","lag 6"],"marker":4},"value":0.9714491332590095,"value_label":"final similarity"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Dot-product terms / fixed full-vector norms","a":[0.19352953571729184,-0.0018153840825768212,0.1914448983853349,0.40265793020428964,0.1878942523029937,-0.0022620992683237812],"a_label":"contributions","labels":["lag 1","lag 2","lag 3","lag 4","lag 5","lag 6"],"marker":5},"value":0.9714491332590095,"value_label":"final similarity"}],"echotime_status":"Low-priority addition","echotime_api":""}
