{"id":"trend_embedding_similarity","title":"Linear trend features embedding similarity","family":"embedding","definition":"reference","intro_en":"Fit an ordinary least-squares line to each series on the sample-index axis. Compare the intercept, slope and population standard deviation of residuals. This is EchoTime's three-coordinate trend description; it retains overall direction and unexplained variation while compressing local structure. Cosine compares vector direction and is defined here for nonzero feature vectors.","intro_zh":"以样本索引为时间轴，对每条序列拟合普通最小二乘直线，再比较截距、斜率和残差的总体标准差。这是 EchoTime 的三坐标趋势描述，保留总体方向与未解释波动，同时压缩局部结构。 余弦比较向量方向，本例特征向量均非零。","steps_en":["Fit x_t = intercept + slope*t and append the residual population SD.","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":["拟合 x_t = 截距 + 斜率*t，并加入残差总体标准差。","把计算得到的坐标按同一个固定顺序组成两个向量。","用两个向量的长度归一化坐标乘积之和，得到余弦相似度。","结合表示所舍弃的信息，在该表示空间中解释分数。"],"animation_steps_en":["Fit a line; retain intercept, slope and residual population SD.","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":["The slope uses sample index, so changing the sampling interval changes its interpretation; physical-time comparisons require consistent units.","Intercept, slope and residual SD have different scales. Curved trends and different residual patterns can share the same vector.","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-cosine 通常不满足度量公理，零向量还需明确处理规则。"],"sources":[{"label":"EchoTime low-level implementation","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/similarity_methods.py"},{"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":{"time_axis":"sample index 0..15","fit":"ordinary least squares","residual_std_ddof":0,"features":["intercept","slope","residual_std"],"comparison":"cosine"},"result":{"label":"similarity","value":0.9981196187923687,"detail":"Computed from the explicitly defined illustrative encoder; no learned weights."},"frames":[{"phase":0,"caption":"Fit a straight line to the first 4 samples; retain residual variation.","panel":{"kind":"lines","title":"Least-squares trends on first 4 samples","a":[0.2744368972633516,0.5036110001104148,0.7327851029574781,0.9619592058045412],"a_label":"x fitted","b":[-0.21019805153394627,0.189933982822018,0.5900660171779823,0.9901980515339466],"b_label":"y fitted"},"input_highlight":[0,1,2,3]},{"phase":0,"caption":"Fit a straight line to the first 6 samples; retain residual variation.","panel":{"kind":"lines","title":"Least-squares trends on first 6 samples","a":[0.6929856655212363,0.5682178061839347,0.4434499468466331,0.3186820875093315,0.1939142281720299,0.06914636883472836],"a_label":"x fitted","b":[0.08750901898907723,0.24486075045277364,0.4022124819164701,0.5595642133801665,0.7169159448438629,0.8742676763075593],"b_label":"y fitted"},"input_highlight":[0,1,2,3,4,5]},{"phase":0,"caption":"Fit a straight line to the first 8 samples; retain residual variation.","panel":{"kind":"lines","title":"Least-squares trends on first 8 samples","a":[0.7242640687119283,0.5741359629668266,0.4240078572217248,0.273879751476623,0.12375164573152131,-0.026376460013580405,-0.17650456575868223,-0.32663267150378383],"a_label":"x fitted","b":[0.4599999999999999,0.40642857142857136,0.35285714285714276,0.29928571428571416,0.2457142857142856,0.192142857142857,0.13857142857142846,0.08499999999999991],"b_label":"y fitted"},"input_highlight":[0,1,2,3,4,5,6,7]},{"phase":0,"caption":"Fit a straight line to the first 10 samples; retain residual variation.","panel":{"kind":"lines","title":"Least-squares trends on first 10 samples","a":[0.4126739627014448,0.38511077328041016,0.3575475838593756,0.32998439443834093,0.30242120501730635,0.2748580155962717,0.2472948261752371,0.2197316367542025,0.19216844733316787,0.16460525791213326],"a_label":"x fitted","b":[0.38475728053544594,0.35980388295223764,0.3348504853690294,0.3098970877858211,0.2849436902026128,0.25999029261940454,0.23503689503619624,0.21008349745298793,0.18513009986977966,0.16017670228657138],"b_label":"y fitted"},"input_highlight":[0,1,2,3,4,5,6,7,8,9]},{"phase":0,"caption":"Fit a straight line to the first 12 samples; retain residual variation.","panel":{"kind":"lines","title":"Least-squares trends on first 12 samples","a":[0.16859318072653615,0.2208609691722536,0.273128757617971,0.32539654606368845,0.3776643345094059,0.4299321229551233,0.48219991140084073,0.5344676998465582,0.5867354882922756,0.6390032767379931,0.6912710651837105,0.743538853629428],"a_label":"x fitted","b":[0.16997460877769927,0.21270649809084483,0.2554383874039904,0.2981702767171359,0.3409021660302815,0.3836340553434271,0.4263659446565726,0.4690978339697182,0.5118297232828637,0.5545616125960093,0.5972935019091549,0.6400253912223004],"b_label":"y fitted"},"input_highlight":[0,1,2,3,4,5,6,7,8,9,10,11]},{"phase":0,"caption":"Fit a straight line to the first 16 samples; retain residual variation.","panel":{"kind":"lines","title":"Least-squares trends on first 16 samples","a":[0.4044477704393201,0.4005214010474108,0.3965950316555014,0.3926686622635921,0.38874229287168277,0.38481592347977345,0.38088955408786407,0.37696318469595474,0.3730368153040454,0.3691104459121361,0.3651840765202267,0.3612577071283174,0.3573313377364081,0.35340496834449875,0.34947859895258937,0.34555222956068005],"a_label":"x fitted","b":[0.3141176470588237,0.32723529411764724,0.34035294117647075,0.3534705882352943,0.3665882352941178,0.37970588235294134,0.39282352941176485,0.40594117647058836,0.41905882352941193,0.43217647058823544,0.44529411764705895,0.45841176470588246,0.471529411764706,0.48464705882352954,0.497764705882353,0.5108823529411766],"b_label":"y fitted"},"input_highlight":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]},{"phase":1,"caption":"Expose 1 of 3 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4044477704393201],"a_label":"x features","b":[0.3141176470588237],"b_label":"y features","labels":["intercept"],"marker":0}},{"phase":1,"caption":"Expose 1 of 3 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4044477704393201],"a_label":"x features","b":[0.3141176470588237],"b_label":"y features","labels":["intercept"],"marker":0}},{"phase":1,"caption":"Expose 1 of 3 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4044477704393201],"a_label":"x features","b":[0.3141176470588237],"b_label":"y features","labels":["intercept"],"marker":0}},{"phase":1,"caption":"Expose 2 of 3 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4044477704393201,-0.003926369391909338],"a_label":"x features","b":[0.3141176470588237,0.013117647058823522],"b_label":"y features","labels":["intercept","slope"],"marker":1}},{"phase":1,"caption":"Expose 2 of 3 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4044477704393201,-0.003926369391909338],"a_label":"x features","b":[0.3141176470588237,0.013117647058823522],"b_label":"y features","labels":["intercept","slope"],"marker":1}},{"phase":1,"caption":"Expose 3 of 3 coordinates; each has the same meaning in x and y.","panel":{"kind":"bars","title":"Feature vectors","a":[0.4044477704393201,-0.003926369391909338,0.6100567826027345],"a_label":"x features","b":[0.3141176470588237,0.013117647058823522,0.5359801357161971],"b_label":"y features","labels":["intercept","slope","resid SD"],"marker":2}},{"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.27932465306443793],"a_label":"contributions","labels":["intercept"],"marker":0},"value":0.27932465306443793,"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.27932465306443793],"a_label":"contributions","labels":["intercept"],"marker":0},"value":0.27932465306443793,"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.27932465306443793],"a_label":"contributions","labels":["intercept"],"marker":0},"value":0.27932465306443793,"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.27932465306443793,-0.00011324044931429614],"a_label":"contributions","labels":["intercept","slope"],"marker":1},"value":0.2792114126151236,"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.27932465306443793,-0.00011324044931429614],"a_label":"contributions","labels":["intercept","slope"],"marker":1},"value":0.2792114126151236,"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.27932465306443793,-0.00011324044931429614,0.718908206177245],"a_label":"contributions","labels":["intercept","slope","resid SD"],"marker":2},"value":0.9981196187923687,"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.27932465306443793,-0.00011324044931429614,0.718908206177245],"a_label":"contributions","labels":["intercept","slope","resid SD"],"marker":0},"value":0.9981196187923687,"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.27932465306443793,-0.00011324044931429614,0.718908206177245],"a_label":"contributions","labels":["intercept","slope","resid SD"],"marker":1},"value":0.9981196187923687,"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.27932465306443793,-0.00011324044931429614,0.718908206177245],"a_label":"contributions","labels":["intercept","slope","resid SD"],"marker":2},"value":0.9981196187923687,"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.27932465306443793,-0.00011324044931429614,0.718908206177245],"a_label":"contributions","labels":["intercept","slope","resid SD"],"marker":2},"value":0.9981196187923687,"value_label":"final similarity"}],"echotime_status":"Low-priority addition","echotime_api":""}
