{"id":"ar_spectrum_distance","family":"model-based","definition":"protocol","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":2,"demean":"separately using full series mean","intercept":false,"estimator":"conditional OLS, no regularization","residual_variance":"mean squared fitted residual","beta_x":[1.0243090422834804,-0.6188171023843692],"beta_y":[1.2418713737062936,-0.8788590636409944],"ar_companion_root_radii_x":[0.7866492880466931,0.7866492880466931],"ar_companion_root_radii_y":[0.9374748336040784,0.9374748336040784],"omega":[0.0,0.19634954084936207,0.39269908169872414,0.5890486225480862,0.7853981633974483,0.9817477042468103,1.1780972450961724,1.3744467859455345,1.5707963267948966,1.7671458676442586,1.9634954084936207,2.1598449493429825,2.356194490192345,2.552544031041707,2.748893571891069,2.945243112740431,3.141592653589793],"spectrum_convention":"sigma2/abs(AR polynomial)^2; common 1/(2pi) omitted","log_base":"e"},"sources":[{"label":"statsmodels: conditional least-squares autoregression","url":"https://www.statsmodels.org/stable/generated/statsmodels.tsa.ar_model.AutoReg.html"},{"label":"Exact illustrative inputs and encoder definitions","url":"https://github.com/ZipengWu365/EchoTime/blob/main/tools/method_animation_data/feature_model_embedding.py"},{"label":"statsmodels: ARMA lag-polynomial spectra","url":"https://www.statsmodels.org/stable/generated/statsmodels.tsa.arima_process.arma_periodogram.html"}],"caveats_en":["The example fixes order two and demeans each series separately. Changing order, centering or estimator changes the fitted object.","Sixteen samples suffice only for an illustration, not a reliable claim about the generating process.","The spectrum is an AR model implication; stability and stationarity assumptions require scrutiny. Grid density and log conventions change the numeric distance."],"caveats_zh":["本例固定二阶，并分别去均值；改变阶数、中心化或估计器都会改变拟合对象。","十六个样本仅用于解释过程，不能据此可靠推断生成机制。","该谱是 AR 模型的推论，需要检查稳定性和平稳性假设。网格密度及对数约定会改变数值距离。"],"title":"AR log-spectrum distance","intro_en":"Fit the same centered AR(2) model to each input and evaluate its implied spectrum on 17 shared frequencies. The animation compares natural-log spectra with Euclidean distance. The two final fits are stable; their fitted residual variances are included, so both spectral shape and power level affect the score.","intro_zh":"对两条输入拟合相同的中心化 AR(2) 模型，并在 17 个共享频点上计算模型隐含谱。动图以欧氏距离比较自然对数谱。两个最终拟合均稳定，且纳入拟合残差方差，因此谱形状和功率水平都会影响分数。","steps_en":["Demean each input, build two lags and fit conditional-OLS AR(2) models.","Check stability and evaluate sigma^2 / |1-phi_1 exp(-iw)-phi_2 exp(-2iw)|^2.","Take natural logs on the same 17-point frequency grid.","Take the Euclidean norm of the log-spectrum difference."],"steps_zh":["分别去均值，构造两个滞后量并拟合条件最小二乘 AR(2)。","检查稳定性，计算 sigma^2 / |1-phi_1 exp(-iw)-phi_2 exp(-2iw)|^2。","在相同的 17 点频率网格上取自然对数。","计算对数谱差的欧氏范数。"],"formula":"S(w)=sigma^2/|1-sum_(j=1)^2 phi_j exp(-ijw)|^2; d=||log S_x-log S_y||_2","result":{"label":"distance","value":5.96535961650699,"detail":"Unweighted L2 over 17 natural-log spectral coordinates; no integration weighting."},"frames":[{"phase":0,"caption":"Build 2 lagged rows: x lags in the left columns, y lags in the right.","panel":{"kind":"matrix","title":"AR(2) design: [x lag1, x lag2 | y lag1, y lag2]","z":[[0.5019216919004694,-0.3749999999999999,-0.22749999999999998,-0.6128300858899106],[0.4344744111674237,0.5019216919004694,0.15783008588991065,-0.22749999999999998]],"row_label":"prediction row","col_label":"lagged predictors","cursor":[1,0]}},{"phase":0,"caption":"Build 4 lagged rows: x lags in the left columns, y lags in the right.","panel":{"kind":"matrix","title":"AR(2) design: [x lag1, x lag2 | y lag1, y lag2]","z":[[0.5019216919004694,-0.3749999999999999,-0.22749999999999998,-0.6128300858899106],[0.4344744111674237,0.5019216919004694,0.15783008588991065,-0.22749999999999998],[0.411396103067893,0.4344744111674237,0.5924999999999999,0.15783008588991065],[0.01552558883257682,0.411396103067893,0.5878300858899107,0.5924999999999999]],"row_label":"prediction row","col_label":"lagged predictors","cursor":[3,0]}},{"phase":0,"caption":"Build 6 lagged rows: x lags in the left columns, y lags in the right.","panel":{"kind":"matrix","title":"AR(2) design: [x lag1, x lag2 | y lag1, y lag2]","z":[[0.5019216919004694,-0.3749999999999999,-0.22749999999999998,-0.6128300858899106],[0.4344744111674237,0.5019216919004694,0.15783008588991065,-0.22749999999999998],[0.411396103067893,0.4344744111674237,0.5924999999999999,0.15783008588991065],[0.01552558883257682,0.411396103067893,0.5878300858899107,0.5924999999999999],[-0.9519216919004692,0.01552558883257682,-0.0874999999999998,0.5878300858899107],[-0.975,-0.9519216919004692,-0.7628300858899106,-0.0874999999999998]],"row_label":"prediction row","col_label":"lagged predictors","cursor":[5,0]}},{"phase":0,"caption":"Build 8 lagged rows: x lags in the left columns, y lags in the right.","panel":{"kind":"matrix","title":"AR(2) design: [x lag1, x lag2 | y lag1, y lag2]","z":[[0.5019216919004694,-0.3749999999999999,-0.22749999999999998,-0.6128300858899106],[0.4344744111674237,0.5019216919004694,0.15783008588991065,-0.22749999999999998],[0.411396103067893,0.4344744111674237,0.5924999999999999,0.15783008588991065],[0.01552558883257682,0.411396103067893,0.5878300858899107,0.5924999999999999],[-0.9519216919004692,0.01552558883257682,-0.0874999999999998,0.5878300858899107],[-0.975,-0.9519216919004692,-0.7628300858899106,-0.0874999999999998],[-0.4708705142353162,-0.975,-0.7675000000000001,-0.7628300858899106],[-0.1655255888325764,-0.4708705142353162,-0.3328300858899107,-0.7675000000000001]],"row_label":"prediction row","col_label":"lagged predictors","cursor":[7,0]}},{"phase":0,"caption":"Build 11 lagged rows: x lags in the left columns, y lags in the right.","panel":{"kind":"matrix","title":"AR(2) design: [x lag1, x lag2 | y lag1, y lag2]","z":[[0.5019216919004694,-0.3749999999999999,-0.22749999999999998,-0.6128300858899106],[0.4344744111674237,0.5019216919004694,0.15783008588991065,-0.22749999999999998],[0.411396103067893,0.4344744111674237,0.5924999999999999,0.15783008588991065],[0.01552558883257682,0.411396103067893,0.5878300858899107,0.5924999999999999],[-0.9519216919004692,0.01552558883257682,-0.0874999999999998,0.5878300858899107],[-0.975,-0.9519216919004692,-0.7628300858899106,-0.0874999999999998],[-0.4708705142353162,-0.975,-0.7675000000000001,-0.7628300858899106],[-0.1655255888325764,-0.4708705142353162,-0.3328300858899107,-0.7675000000000001],[0.7113961030678927,-0.1655255888325764,0.05249999999999999,-0.3328300858899107],[1.2155255888325764,0.7113961030678927,0.43783008588991057,0.05249999999999999],[0.6208705142353174,1.2155255888325764,0.8724999999999995,0.43783008588991057]],"row_label":"prediction row","col_label":"lagged predictors","cursor":[10,0]}},{"phase":0,"caption":"Build 14 lagged rows: x lags in the left columns, y lags in the right.","panel":{"kind":"matrix","title":"AR(2) design: [x lag1, x lag2 | y lag1, y lag2]","z":[[0.5019216919004694,-0.3749999999999999,-0.22749999999999998,-0.6128300858899106],[0.4344744111674237,0.5019216919004694,0.15783008588991065,-0.22749999999999998],[0.411396103067893,0.4344744111674237,0.5924999999999999,0.15783008588991065],[0.01552558883257682,0.411396103067893,0.5878300858899107,0.5924999999999999],[-0.9519216919004692,0.01552558883257682,-0.0874999999999998,0.5878300858899107],[-0.975,-0.9519216919004692,-0.7628300858899106,-0.0874999999999998],[-0.4708705142353162,-0.975,-0.7675000000000001,-0.7628300858899106],[-0.1655255888325764,-0.4708705142353162,-0.3328300858899107,-0.7675000000000001],[0.7113961030678927,-0.1655255888325764,0.05249999999999999,-0.3328300858899107],[1.2155255888325764,0.7113961030678927,0.43783008588991057,0.05249999999999999],[0.6208705142353174,1.2155255888325764,0.8724999999999995,0.43783008588991057],[0.2250000000000003,0.6208705142353174,0.8678300858899114,0.8724999999999995],[-0.17087051423531652,0.2250000000000003,0.19250000000000023,0.8678300858899114],[-0.765525588832576,-0.17087051423531652,-0.48283008588991083,0.19250000000000023]],"row_label":"prediction row","col_label":"lagged predictors","cursor":[13,0]}},{"phase":1,"caption":"Expose 1 of 17 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"AR-implied natural-log spectrum vectors","a":[-1.0052603766722035],"a_label":"x features","b":[-2.465996165936032],"b_label":"y features","labels":["0"],"marker":0}},{"phase":1,"caption":"Expose 4 of 17 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"AR-implied natural-log spectrum vectors","a":[-1.0052603766722035,-0.915054045664759,-0.6321972715673676,-0.13699648368931833],"a_label":"x features","b":[-2.465996165936032,-2.3508515001088717,-1.9662063794330553,-1.1344724495756058],"b_label":"y features","labels":["0","1","2","3"],"marker":3}},{"phase":1,"caption":"Expose 7 of 17 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"AR-implied natural-log spectrum vectors","a":[-1.0052603766722035,-0.915054045664759,-0.6321972715673676,-0.13699648368931833,0.3949536516201285,0.1083210883016945,-0.800148065186605],"a_label":"x features","b":[-2.465996165936032,-2.3508515001088717,-1.9662063794330553,-1.1344724495756058,0.8416525002172747,-0.35944541190721857,-2.115934384468391],"b_label":"y features","labels":["0","1","2","3","4","5","6"],"marker":6}},{"phase":1,"caption":"Expose 10 of 17 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"AR-implied natural-log spectrum vectors","a":[-1.0052603766722035,-0.915054045664759,-0.6321972715673676,-0.13699648368931833,0.3949536516201285,0.1083210883016945,-0.800148065186605,-1.6017198473308962,-2.2230379571586627,-2.705773552433812],"a_label":"x features","b":[-2.465996165936032,-2.3508515001088717,-1.9662063794330553,-1.1344724495756058,0.8416525002172747,-0.35944541190721857,-2.115934384468391,-3.1199407309390024,-3.8107153396781634,-4.323950860330583],"b_label":"y features","labels":["0","1","2","3","4","5","6","7","8","9"],"marker":9}},{"phase":1,"caption":"Expose 13 of 17 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"AR-implied natural-log spectrum vectors","a":[-1.0052603766722035,-0.915054045664759,-0.6321972715673676,-0.13699648368931833,0.3949536516201285,0.1083210883016945,-0.800148065186605,-1.6017198473308962,-2.2230379571586627,-2.705773552433812,-3.0842041917007057,-3.3805613640331202,-3.6091462498372486],"a_label":"x features","b":[-2.465996165936032,-2.3508515001088717,-1.9662063794330553,-1.1344724495756058,0.8416525002172747,-0.35944541190721857,-2.115934384468391,-3.1199407309390024,-3.8107153396781634,-4.323950860330583,-4.7180447708828845,-5.0232991006976455,-5.257258795332747],"b_label":"y features","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12"],"marker":12}},{"phase":1,"caption":"Expose 17 of 17 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"AR-implied natural-log spectrum vectors","a":[-1.0052603766722035,-0.915054045664759,-0.6321972715673676,-0.13699648368931833,0.3949536516201285,0.1083210883016945,-0.800148065186605,-1.6017198473308962,-2.2230379571586627,-2.705773552433812,-3.0842041917007057,-3.3805613640331202,-3.6091462498372486,-3.7792914886906357,-3.8970870752836535,-3.9663611420316776,-3.989227111632722],"a_label":"x features","b":[-2.465996165936032,-2.3508515001088717,-1.9662063794330553,-1.1344724495756058,0.8416525002172747,-0.35944541190721857,-2.115934384468391,-3.1199407309390024,-3.8107153396781634,-4.323950860330583,-4.7180447708828845,-5.0232991006976455,-5.257258795332747,-5.4307369566148385,-5.550558053062896,-5.620927341656677,-5.644140241166465],"b_label":"y features","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"],"marker":16}},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205],"a_label":"contributions","labels":["0"],"marker":0},"value":1.4607357892638286,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822],"a_label":"contributions","labels":["0","1","2","3"],"marker":3},"value":2.6400382532481994,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102],"a_label":"contributions","labels":["0","1","2","3","4","5","6"],"marker":6},"value":3.019841217130236,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102,2.3049946514237787,2.5207194709639733,2.618497799792041],"a_label":"contributions","labels":["0","1","2","3","4","5","6","7","8","9"],"marker":9},"value":4.069846790587874,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102,2.3049946514237787,2.5207194709639733,2.618497799792041,2.6694350381823577,2.698587271461687,2.7162749626196527],"a_label":"contributions","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12"],"marker":12},"value":4.96467019761858,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102,2.3049946514237787,2.5207194709639733,2.618497799792041,2.6694350381823577,2.698587271461687,2.7162749626196527,2.727272133527389,2.7339662743582442,2.737589308941514,2.738737466303167],"a_label":"contributions","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"],"marker":16},"value":5.96535961650699,"value_label":"partial distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102,2.3049946514237787,2.5207194709639733,2.618497799792041,2.6694350381823577,2.698587271461687,2.7162749626196527,2.727272133527389,2.7339662743582442,2.737589308941514,2.738737466303167],"a_label":"contributions","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"],"marker":0},"value":5.96535961650699,"value_label":"final distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102,2.3049946514237787,2.5207194709639733,2.618497799792041,2.6694350381823577,2.698587271461687,2.7162749626196527,2.727272133527389,2.7339662743582442,2.737589308941514,2.738737466303167],"a_label":"contributions","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"],"marker":5},"value":5.96535961650699,"value_label":"final distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102,2.3049946514237787,2.5207194709639733,2.618497799792041,2.6694350381823577,2.698587271461687,2.7162749626196527,2.727272133527389,2.7339662743582442,2.737589308941514,2.738737466303167],"a_label":"contributions","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"],"marker":11},"value":5.96535961650699,"value_label":"final distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[2.1337490460362205,2.0615143301881935,1.779580299868608,0.9949583025207822,0.1995398613380161,0.21880549871769508,1.7312936380091102,2.3049946514237787,2.5207194709639733,2.618497799792041,2.6694350381823577,2.698587271461687,2.7162749626196527,2.727272133527389,2.7339662743582442,2.737589308941514,2.738737466303167],"a_label":"contributions","labels":["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"],"marker":16},"value":5.96535961650699,"value_label":"final distance"}],"animation_steps_en":["Demean each input and fit a conditional least-squares AR(2) model.","Check stability; evaluate log spectra on 17 shared frequencies.","Square differences between matching natural-log spectral coordinates.","Take the Euclidean norm of the two log-spectrum vectors."],"echotime_status":"Possible addition","echotime_api":""}
