--- tags: formula title: STLCSS and Similarity Formula --- $0 < \epsilon_1 < 1$ $0 < \epsilon_2 < 1$ $LCSS_{\delta,\epsilon_1,\epsilon2,t,l}(S_p,S_p)$ denoted as $M(S_p,S_q)$ $M(S_p,S_q) = \cases{ 0, \ \ \ \ if\ \ S_p=\emptyset\ \ or\ \ S_q=\emptyset \\ \\ local+M(S_p-S_{pn},\ S_q-S_{qn}), \ \ \ \ if\ a\ \le \epsilon_1\\ \\ Max\cases{\dfrac{\epsilon_1-a}{\epsilon_1-\epsilon_2}+M(S_p-S_{pn},\ S_q-S_{qn})\\\\ M(S_p-S_{pn},\ S_q),\ \ \ \ \ \ \ \ \ \ \ \ if\ \epsilon_1<a\le\epsilon_2 \\\\ M(S_p,\ S_q-S_{qn})}\\ \\ Max\cases{M(S_p-S_{pn},\ S_q)\ \ \ \ \ \ \ if\ \epsilon_2<a\\\\ M(S_p,\ S_q-S_{qn}) } \\ }$ where $local$ = $w1$ x $d(S_{p},S_{q})$ + $w2$ x $|t_{pn}-t_{qm}|$ $a$ = $d(S_p, S_q)$ $0< LCSS_{\delta,\epsilon_1,\epsilon_2,t,l}(S_p,S_q)= M(S_p,S_q)\le min(n,m)$ Similarity is below, $Sim(\delta,\epsilon_1,\epsilon_2,t,l,S_p,S_q) = \dfrac{\alpha_1\times LCSS_{\delta,\epsilon_1,\epsilon2,t,l}(S_p,S_p)+\alpha_2\times |(t_{pn}-t_{p1})-(t_{qm}-t_{q1})|}{min(n,m)}$ --- --- ADJUSTMENT --- Define: $Spatial_{Max}$ --> 地圖上最長距離 $Temporal_{Max}$ --> 有興趣的時間長度 $local$ = $w1$ x $\dfrac{d(S_{p},S_{q})}{Spatial_{Max}}$ + $w2$ x $\dfrac{|t_{pn}-t_{qm}|}{Temporal_{Max}}$ $a$ = $\dfrac{d(S_p, S_q)}{Spatial_{Max}}$ $Sim(\delta,\epsilon_1,\epsilon_2,t,l,S_p,S_q) = \alpha_1\times \dfrac{LCSS_{\delta,\epsilon_1,\epsilon2,t,l}(S_p,S_p)}{min(n,m)}+\alpha_2\times \dfrac{|(t_{pn}-t_{p1})-(t_{qm}-t_{q1})|}{Temporal_{max}}$ $M(S_p,S_q) = \cases{ 0, \ \ \ \ if\ \ S_p=\emptyset\ \ or\ \ S_q=\emptyset \\ \\ local+M(S_p-S_{pn},\ S_q-S_{qn}), \ \ \ \ if\ a\ \le \epsilon_1\\ \\ Max\cases{\dfrac{\epsilon_1-a}{\epsilon_1-\epsilon_2}+M(S_p-S_{pn},\ S_q-S_{qn})\\\\ M(S_p-S_{pn},\ S_q),\ \ \ \ \ \ \ \ \ \ \ \ if\ \epsilon_1<a\le\epsilon_2 \\\\ M(S_p,\ S_q-S_{qn})}\\ \\ Max\cases{M(S_p-S_{pn},\ S_q)\ \ \ \ \ \ \ if\ \epsilon_2<a\\\\ M(S_p,\ S_q-S_{qn}) } \\ }$ --Correction or called trying--- $local$ = $w1$ x (1 - $\dfrac{d(S_{p},S_{q})}{Spatial_{Max}}$) + $w2$ x (1 - $\dfrac{|t_{pn}-t_{qm}|}{Temporal_{Max}}$) 10/18 --- result: | | pattern | (0,0) | (1,0) | (2,0) | (3,0) | | -------- | ------- | ----- | ----- | ----- | ----- | | observed | 0 | 0 | 0 | 0 | 0 | | (0,0) | 0 | 1 | 0.66 | 0.33 | 0 | | (1,0) | 0 | 0.66 | 2 | 1.33 | 0.66 | stlcss_score = 0.66 similarity = 0.333 $Spatial_{Max}$ = 3.0 --Adjustment-- $M(S_p,S_q) = \cases{\\ 0, \ \ \ \ if\ \ S_p=\emptyset\ \ or\ \ S_q=\emptyset \\ \\ Max\cases{local+M(S_p-S_{pn},\ S_q-S_{qn}) \\\\ M(S_p-S_{pn},\ S_q),\ \ \ \ \ \ \ if\ a\ \le \epsilon_1\\\\ M(S_p,\ S_q-S_{qn}) } \\ \\ Max\cases{\dfrac{\epsilon_1-a}{\epsilon_1-\epsilon_2}+M(S_p-S_{pn},\ S_q-S_{qn})\\\\ M(S_p-S_{pn},\ S_q),\ \ \ \ \ \ \ \ \ \ \ \ if\ \epsilon_1<a\le\epsilon_2 \\\\ M(S_p,\ S_q-S_{qn})}\\ \\ Max\cases{M(S_p-S_{pn},\ S_q)\ \ \ \ \ \ \ if\ \epsilon_2<a\\\\ M(S_p,\ S_q-S_{qn}) } \\ }$ result: | | pattern | (0,0) | (1,0) | (2,0) | (3,0) | | -------- | ------- | ----- | ----- | ----- | ----- | | observed | 0 | 0 | 0 | 0 | 0 | | (0,0) | 0 | 1 | 1 | 1 | 1 | | (1,0) | 0 | 1 | 2 | 2 | 2 | stlcss_score = 2.0 similarity = 1.0 $Spatial_{Max}$ = 3.0 ![](https://i.imgur.com/AFKnj7d.png) ST-LCSS score : 8.789181365735503 similarity : 0.9765757073039448 $Spatial_{Max}$ : 6.708203932499369 ![](https://i.imgur.com/UzodeyU.png) -- weighting formula $a_i = \cases{\\ 1,\ \ \ \ \ if\ d(Sp_i, Sq_i)\le\epsilon1\\ \\ \dfrac{\epsilon_1-d(Sp_i, Sq_i)}{\epsilon_1-\epsilon_2} ,\ \ \ \ \ if\ \epsilon1<d(Sp_i, Sq_i)\le\epsilon_2\\\\ 0 ,\ \ \ \ \ if\ \epsilon_2<d(Sp_i, Sq_i)\\\\ \\ }$ $Score$ = $\frac{\sum\limits_{i = 0}^{\alpha+\beta}{w_i.a_i}}{\sum\limits_{i = 0}^{\alpha+\beta}{a_i}}$ $w_i = \cases{ 2^\frac{i}{\alpha} ,\ \ \ \ \ if \ i \le \alpha\\ 2^{1+\frac{i}{\beta}} ,\ \ \ \ \ if \ i > \alpha }$