{"id":"periodogram_distance","title":"Normalized FFT-bin powers distance","family":"feature-based","definition":"echotime","intro_en":"Square the real-FFT magnitudes and normalize their sum to one. EchoTime compares these power-share vectors with Euclidean distance. The example retains all nine bins and the mean-related DC component, so every coordinate represents a share of this particular discrete power convention. Euclidean distance retains differences in both vector scale and coordinates.","intro_zh":"将实数 FFT 幅值平方，再除以总和得到功率占比向量。EchoTime 使用欧氏距离比较该向量。本例保留全部九个频点和与均值相关的直流项，因此每个坐标都是这一离散功率约定下的占比。 欧氏距离同时保留向量尺度与坐标差异。","steps_en":["Square each rFFT magnitude, then divide by the sum over all retained nonnegative-frequency bins.","Collect the computed coordinates in the same fixed order for both inputs.","Take the Euclidean norm of the coordinate differences.","Interpret the score in this representation, accounting for the information it discards."],"steps_zh":["对 rFFT 幅值逐点平方，再除以全部非负频点功率的总和。","把计算得到的坐标按同一个固定顺序组成两个向量。","对坐标差计算欧氏范数。","结合表示所舍弃的信息，在该表示空间中解释分数。"],"animation_steps_en":["Square rFFT magnitudes and divide by their total across all nine bins.","Collect matching coordinates in the same vector order.","Take the Euclidean norm of coordinate differences.","Read the score in this feature space, with its stated information loss."],"formula":"d(x,y) = sqrt(sum_j (phi_j(x)-phi_j(y))^2)","caveats_en":["This is EchoTime's normalized rFFT-bin convention: no detrending, window, or one-sided interior-bin doubling. It is not a physical-density PSD estimate.","Normalization discards total power and phase; positive amplitude rescaling alone leaves this representation unchanged.","A metric on these feature vectors can be only a pseudometric on the original series when the representation loses information."],"caveats_zh":["这是 EchoTime 的归一化 rFFT 频点约定：不去趋势、不加窗，也不把单边谱内部频点乘二；它不等于具有物理单位的功率谱密度估计。","归一化舍弃总功率和相位；单纯的正振幅缩放不会改变此表示。","当表示损失信息时，特征空间中的度量在原序列空间上可能只是伪度量。"],"sources":[{"label":"EchoTime low-level implementation","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/similarity_methods.py"},{"label":"NumPy: real-input discrete Fourier transform","url":"https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft.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":{"n_coeffs":9,"normalization":"divide rFFT squared magnitudes by their sum","detrend":false,"one_sided_doubling":false,"comparison":"euclidean"},"result":{"label":"distance","value":0.13173288260592061,"detail":"Computed from the explicitly defined illustrative encoder; no learned weights."},"frames":[{"phase":0,"caption":"Bin 0: sum cos-weighted samples to obtain a Fourier component.","panel":{"kind":"lines","title":"Frequency k=0: cos-weighted samples","a":[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],"a_label":"x weighted","b":[-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],"b_label":"y weighted"},"value":5.999999999999998,"value_label":"x cos component"},{"phase":0,"caption":"Bin 1: sum cos-weighted samples to obtain a Fourier component.","panel":{"kind":"lines","title":"Frequency k=1: cos-weighted samples","a":[0.0,0.8101700027620122,0.5723848453334728,0.3009407599205522,2.3912795617447522e-17,0.22077837326234637,0.42426406871192857,0.08857280587334067,-0.2094744111674235,-1.0036991238244484,-1.1246714295142415,-0.38110314657875877,-1.1021821192326182e-16,0.07811697225934981,-0.27614329209038396,0.10495631518909389],"a_label":"x weighted","b":[-0.2003300858899106,0.17091771351458804,0.4032842712474619,0.38459684952691525,6.12525518887938e-17,-0.12437211551865422,0.24772077938642142,0.32797723404150686,-0.07966991411008931,-0.42960398261774835,-0.6012741699796953,-0.49174821058914087,-2.3519282123057037e-16,0.23152347658087952,-0.04973088065418826,-0.06929096493834688],"b_label":"y weighted"},"value":-0.39490725986315967,"value_label":"x cos component"},{"phase":0,"caption":"Bin 1: sum sin-weighted samples to obtain a Fourier component.","panel":{"kind":"lines","title":"Frequency k=1: sin-weighted samples","a":[-0.0,-0.33558340297187333,-0.5723848453334728,-0.7265352640710625,-0.3905255888325767,0.5330061430086261,0.4242640687119286,0.036688057450177045,-2.5653216713946175e-17,0.41574578963007885,1.1246714295142413,0.9200643851334994,0.6000000000000002,0.18859105388004502,-0.27614329209038413,0.043474329208028045],"a_label":"x weighted","b":[0.0,-0.07079643498754161,-0.40328427124746186,-0.9284989301738431,-1.0003300858899107,-0.3002608480661684,0.24772077938642148,0.13585261848960695,-9.756750530326542e-18,0.17794779604976668,0.6012741699796951,1.1871851992770026,1.2803300858899114,0.5589471171693285,-0.04973088065418828,-0.028701257427381943],"b_label":"y weighted"},"value":1.985332863237255,"value_label":"x sin component"},{"phase":0,"caption":"Bin 2: sum cos-weighted samples to obtain a Fourier component.","panel":{"kind":"lines","title":"Frequency k=2: cos-weighted samples","a":[0.0,0.6200772749124023,4.956601233139369e-17,-0.5560660171779821,-0.3905255888325767,0.407945240556438,1.102182119232618e-16,-0.06779069073163356,0.2094744111674235,0.7681980515339464,4.869580178314435e-16,-0.7041867937995262,-0.6000000000000002,-0.14434134362433035,1.673895693221324e-16,0.08033008588990923],"a_label":"x weighted","b":[-0.2003300858899106,0.1308147545195113,3.49226457071257e-17,-0.7106423150924801,-1.0003300858899107,-0.22980970388562813,6.435459274951446e-17,-0.2510229073212244,0.07966991411008931,0.3288046532517446,2.603385044759432e-16,-0.9086322138247122,-1.2803300858899114,-0.42779960261786115,3.0145330099093203e-17,-0.05303300858899129],"b_label":"y weighted"},"value":-0.37688537010592893,"value_label":"x cos component"},{"phase":0,"caption":"Bin 2: sum sin-weighted samples to obtain a Fourier component.","panel":{"kind":"lines","title":"Frequency k=2: sin-weighted samples","a":[-0.0,-0.6200772749124022,-0.8094744111674236,-0.5560660171779822,-4.7825591234895043e-17,-0.4079452405564379,-0.6000000000000001,-0.0677906907316336,5.130643342789235e-17,-0.768198051533946,-1.5905255888325764,-0.7041867937995279,-2.2043642384652363e-16,0.14434134362433051,-0.39052558883257615,0.08033008588990943],"a_label":"x weighted","b":[0.0,-0.13081475451951127,-0.5703300858899106,-0.7106423150924802,-1.225051037775876e-16,0.22980970388562805,-0.35033008588991066,-0.2510229073212245,1.9513501060653085e-17,-0.3288046532517445,-0.8503300858899105,-0.9086322138247143,-4.703856424611407e-16,0.42779960261786165,-0.07033008588991083,-0.05303300858899144],"b_label":"y weighted"},"value":-6.290118228030266,"value_label":"x sin component"},{"phase":0,"caption":"Bin 3: sum cos-weighted samples to obtain a Fourier component.","panel":{"kind":"lines","title":"Frequency k=3: cos-weighted samples","a":[0.0,0.3355834029718734,-0.5723848453334728,-0.7265352640710626,-7.173838685234256e-17,-0.533006143008626,-0.4242640687119287,0.036688057450177045,-0.2094744111674235,-0.4157457896300798,1.1246714295142397,0.9200643851334996,3.3065463576978547e-16,-0.18859105388004496,0.27614329209038396,0.043474329208027955],"a_label":"x weighted","b":[-0.2003300858899106,0.07079643498754162,-0.40328427124746186,-0.9284989301738432,-1.8375765566638138e-16,0.30026084806616826,-0.2477207793864215,0.13585261848960695,-0.07966991411008931,-0.1779477960497671,0.6012741699796943,1.187185199277003,7.055784636917111e-16,-0.5589471171693284,0.04973088065418826,-0.02870125742738188],"b_label":"y weighted"},"value":-0.3333766794344364,"value_label":"x cos component"},{"phase":1,"caption":"Expose 1 of 9 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4286499092700476],"a_label":"x features","b":[0.5388528224210274],"b_label":"y features","labels":["k0"],"marker":0}},{"phase":1,"caption":"Expose 2 of 9 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4286499092700476,0.04878867455136337],"a_label":"x features","b":[0.5388528224210274,0.025481612225582314],"b_label":"y features","labels":["k0","k1"],"marker":1}},{"phase":1,"caption":"Expose 4 of 9 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4286499092700476,0.04878867455136337,0.47279644322279196,0.0042873874396206985],"a_label":"x features","b":[0.5388528224210274,0.025481612225582314,0.4103909613077463,0.00314210299329692],"b_label":"y features","labels":["k0","k1","k2","k3"],"marker":3}},{"phase":1,"caption":"Expose 5 of 9 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4286499092700476,0.04878867455136337,0.47279644322279196,0.0042873874396206985,0.001044942005352514],"a_label":"x features","b":[0.5388528224210274,0.025481612225582314,0.4103909613077463,0.00314210299329692,0.017615390705407342],"b_label":"y features","labels":["k0","k1","k2","k3","k4"],"marker":4}},{"phase":1,"caption":"Expose 7 of 9 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4286499092700476,0.04878867455136337,0.47279644322279196,0.0042873874396206985,0.001044942005352514,0.008996944804813537,0.019595902813590645],"a_label":"x features","b":[0.5388528224210274,0.025481612225582314,0.4103909613077463,0.00314210299329692,0.017615390705407342,0.0014028317614680696,0.001136233688691256],"b_label":"y features","labels":["k0","k1","k2","k3","k4","k5","k6"],"marker":6}},{"phase":1,"caption":"Expose 9 of 9 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4286499092700476,0.04878867455136337,0.47279644322279196,0.0042873874396206985,0.001044942005352514,0.008996944804813537,0.019595902813590645,0.0085760738230878,0.007263722069331873],"a_label":"x features","b":[0.5388528224210274,0.025481612225582314,0.4103909613077463,0.00314210299329692,0.017615390705407342,0.0014028317614680696,0.001136233688691256,0.001008208779291669,0.0009698361174887076],"b_label":"y features","labels":["k0","k1","k2","k3","k4","k5","k6","k7","k8"],"marker":8}},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396],"a_label":"contributions","labels":["k0"],"marker":0},"value":0.1102029131509798,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426],"a_label":"contributions","labels":["k0","k1"],"marker":1},"value":0.11264058425461153,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06],"a_label":"contributions","labels":["k0","k1","k2","k3"],"marker":3},"value":0.12877754878367703,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06,0.00027457977012114877],"a_label":"contributions","labels":["k0","k1","k2","k3","k4"],"marker":4},"value":0.12983927310661234,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06,0.00027457977012114877,5.7670552915109756e-05,0.0003407593842007637],"a_label":"contributions","labels":["k0","k1","k2","k3","k4","k5","k6"],"marker":6},"value":0.1313646329038731,"value_label":"partial distance"},{"phase":2,"caption":"Accumulate squared differences, then take the square root.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06,0.00027457977012114877,5.7670552915109756e-05,0.0003407593842007637,5.72725813211114e-05,3.961300037480874e-05],"a_label":"contributions","labels":["k0","k1","k2","k3","k4","k5","k6","k7","k8"],"marker":8},"value":0.13173288260592061,"value_label":"partial distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06,0.00027457977012114877,5.7670552915109756e-05,0.0003407593842007637,5.72725813211114e-05,3.961300037480874e-05],"a_label":"contributions","labels":["k0","k1","k2","k3","k4","k5","k6","k7","k8"],"marker":0},"value":0.13173288260592061,"value_label":"final distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06,0.00027457977012114877,5.7670552915109756e-05,0.0003407593842007637,5.72725813211114e-05,3.961300037480874e-05],"a_label":"contributions","labels":["k0","k1","k2","k3","k4","k5","k6","k7","k8"],"marker":3},"value":0.13173288260592061,"value_label":"final distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06,0.00027457977012114877,5.7670552915109756e-05,0.0003407593842007637,5.72725813211114e-05,3.961300037480874e-05],"a_label":"contributions","labels":["k0","k1","k2","k3","k4","k5","k6","k7","k8"],"marker":6},"value":0.13173288260592061,"value_label":"final distance"},{"phase":3,"caption":"Read the completed comparison using every retained coordinate.","panel":{"kind":"bars","title":"Squared coordinate differences","a":[0.012144682066962396,0.0005432191542578426,0.003894444173049088,1.3116764629911641e-06,0.00027457977012114877,5.7670552915109756e-05,0.0003407593842007637,5.72725813211114e-05,3.961300037480874e-05],"a_label":"contributions","labels":["k0","k1","k2","k3","k4","k5","k6","k7","k8"],"marker":8},"value":0.13173288260592061,"value_label":"final distance"}],"checks":{"api":"echotime.periodogram_distance","expected":0.13173288260592061,"observed":0.1317328826059206,"tolerance":1e-10},"echotime_status":"Implemented in EchoTime","echotime_api":"periodogram_distance"}
