{"id":"bhattacharyya_distance","title":"Bhattacharyya distance","family":"lock-step","definition":"reference","intro_en":"Bhattacharyya distance first adds the geometric-mean overlap of corresponding probability masses. It then applies a negative logarithm, so greater overlap gives a smaller distance. The animation separates the overlap coefficient from the final transformed score. The supplied positive distributions overlap everywhere, making the logarithm finite without a numerical floor.","intro_zh":"Bhattacharyya 距离先累加对应概率质量的几何平均重叠，再取负对数，使更大重叠对应更小距离。动画区分重叠系数和最终变换结果。本例各箱概率为正，无需数值下限即可保证对数有限。","steps_en":["Declare one shared bin support and normalize nonnegative mass to sum to one.","Compute geometric-mean overlap in each bin.","Accumulate the displayed bin contributions, retaining any signed terms.","Apply negative log to the full overlap coefficient."],"steps_zh":["声明共同箱支持集，将非负质量归一化为概率。","按该方法公式计算逐箱贡献。","累加所示贡献，保留可能出现的符号。","应用所示最后的根号、对数或直接求和。"],"formula":"-log(sum_i sqrt(p_i*q_i))","caveats_en":["Disjoint support gives zero overlap and infinite distance.","This log-overlap quantity generally lacks the triangle inequality."],"caveats_zh":["支持集不相交时重叠为零、距离为无穷。","该负对数重叠量一般不满足三角不等式。"],"sources":[{"label":"Imported registry: overlap definition","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/data/ts_similarity_package_v2_registry.csv"}],"x":[1.0,3.0,6.0,9.0,7.0,4.0,2.0,1.0],"y":[1.0,2.0,3.0,6.0,9.0,7.0,4.0,2.0],"input_label":"Synthetic counts on eight shared bins; these bins are not timestamps.","parameters":{"probability_p":[0.030303030303030304,0.09090909090909091,0.18181818181818182,0.2727272727272727,0.21212121212121213,0.12121212121212122,0.06060606060606061,0.030303030303030304],"probability_q":[0.029411764705882353,0.058823529411764705,0.08823529411764706,0.17647058823529413,0.2647058823529412,0.20588235294117646,0.11764705882352941,0.058823529411764705],"log_base":"e","smoothing":"none","support":"eight shared illustrative bins"},"result":{"label":"distance","value":0.029824886413364903,"detail":""},"frames":[{"phase":0,"caption":"Probability mass on shared bins","panel":{"kind":"lines","title":"Probability mass on shared bins","a":[0.030303030303030304,0.09090909090909091],"a_label":"x","b":[0.029411764705882353,0.058823529411764705],"b_label":"y","marker":1}},{"phase":0,"caption":"Probability mass on shared bins","panel":{"kind":"lines","title":"Probability mass on shared bins","a":[0.030303030303030304,0.09090909090909091,0.18181818181818182,0.2727272727272727],"a_label":"x","b":[0.029411764705882353,0.058823529411764705,0.08823529411764706,0.17647058823529413],"b_label":"y","marker":3}},{"phase":0,"caption":"Probability mass on shared bins","panel":{"kind":"lines","title":"Probability mass on shared bins","a":[0.030303030303030304,0.09090909090909091,0.18181818181818182,0.2727272727272727,0.21212121212121213,0.12121212121212122],"a_label":"x","b":[0.029411764705882353,0.058823529411764705,0.08823529411764706,0.17647058823529413,0.2647058823529412,0.20588235294117646],"b_label":"y","marker":5}},{"phase":0,"caption":"Probability mass on shared bins","panel":{"kind":"lines","title":"Probability mass on shared bins","a":[0.030303030303030304,0.09090909090909091,0.18181818181818182,0.2727272727272727,0.21212121212121213,0.12121212121212122,0.06060606060606061,0.030303030303030304],"a_label":"x","b":[0.029411764705882353,0.058823529411764705,0.08823529411764706,0.17647058823529413,0.2647058823529412,0.20588235294117646,0.11764705882352941,0.058823529411764705],"b_label":"y","marker":7}},{"phase":1,"caption":"Compute coordinate 1: Compute geometric-mean overlap in each bin","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"a_label":"contribution","marker":0},"value":0.029854071701326607,"value_label":"coordinate term","input_highlight":[0]},{"phase":1,"caption":"Compute coordinate 3: Compute geometric-mean overlap in each bin","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.0,0.0,0.0,0.0,0.0],"a_label":"contribution","marker":2},"value":0.12666009927622474,"value_label":"coordinate term","input_highlight":[2]},{"phase":1,"caption":"Compute coordinate 5: Compute geometric-mean overlap in each bin","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.0,0.0,0.0],"a_label":"contribution","marker":4},"value":0.23695934803320348,"value_label":"coordinate term","input_highlight":[4]},{"phase":1,"caption":"Compute coordinate 8: Compute geometric-mean overlap in each bin","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.08444006618414981,0.04222003309207491],"a_label":"contribution","marker":7},"value":0.04222003309207491,"value_label":"coordinate term","input_highlight":[7]},{"phase":2,"caption":"Accumulate 1 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"a_label":"contribution","marker":0},"value":0.029854071701326607,"value_label":"running sum"},{"phase":2,"caption":"Accumulate 2 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.07312724241271307,0.0,0.0,0.0,0.0,0.0,0.0],"a_label":"contribution","marker":1},"value":0.10298131411403967,"value_label":"running sum"},{"phase":2,"caption":"Accumulate 3 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.0,0.0,0.0,0.0,0.0],"a_label":"contribution","marker":2},"value":0.2296414133902644,"value_label":"running sum"},{"phase":2,"caption":"Accumulate 4 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.0,0.0,0.0,0.0],"a_label":"contribution","marker":3},"value":0.4490231406284036,"value_label":"running sum"},{"phase":2,"caption":"Accumulate 5 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.0,0.0,0.0],"a_label":"contribution","marker":4},"value":0.685982488661607,"value_label":"running sum"},{"phase":2,"caption":"Accumulate 6 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.0,0.0],"a_label":"contribution","marker":5},"value":0.8439553873504093,"value_label":"running sum"},{"phase":2,"caption":"Accumulate 7 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.08444006618414981,0.0],"a_label":"contribution","marker":6},"value":0.9283954535345591,"value_label":"running sum"},{"phase":2,"caption":"Accumulate 8 of 8 coordinate terms","panel":{"kind":"bars","title":"Terms included so far","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.08444006618414981,0.04222003309207491],"a_label":"contribution","marker":7},"value":0.9706154866266341,"value_label":"running sum"},{"phase":3,"caption":"Apply negative log to the full overlap coefficient","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.08444006618414981,0.04222003309207491],"a_label":"contribution","marker":0},"value":0.029824886413364903,"value_label":"final result"},{"phase":3,"caption":"Apply negative log to the full overlap coefficient","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.08444006618414981,0.04222003309207491],"a_label":"contribution","marker":2},"value":0.029824886413364903,"value_label":"final result"},{"phase":3,"caption":"Apply negative log to the full overlap coefficient","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.08444006618414981,0.04222003309207491],"a_label":"contribution","marker":4},"value":0.029824886413364903,"value_label":"final result"},{"phase":3,"caption":"Apply negative log to the full overlap coefficient","panel":{"kind":"bars","title":"Compute geometric-mean overlap in each bin","a":[0.029854071701326607,0.07312724241271307,0.12666009927622474,0.2193817272381392,0.23695934803320348,0.15797289868880232,0.08444006618414981,0.04222003309207491],"a_label":"contribution","marker":7},"value":0.029824886413364903,"value_label":"final result"}],"animation_steps_en":["Normalize counts on one shared bin support.","Compute geometric-mean overlap in each bin.","Accumulate the displayed bin contributions.","Apply negative log to the full overlap coefficient."],"echotime_status":"Low-priority addition","echotime_api":""}
