## 3 Proposed Novel Matrix Profile for Similarity Search
### All-Pairs Similarity Search Process
#### 3.2.2 Edit-Based Similarity  
The edit-based method is used to characterize the distance between two strings. The underlying idea is that the minimum number of operations needed to transform one string into another, with insertion, deletion, and substitution, can represent the distance between strings. The longest common subsequence (LCSS) algorithm is used to handle outliers or noisiness in matching two time series, as discussed in [PERSON] et al. [32]. For point matching and a warping threshold \(\delta\), the LCSS distance utilizes the threshold parameter \(\varepsilon\). To compare the shapes of subsequences between two series, the NMP utilizes the z-normalized Euclidean distance. **Property 5**. : _The z-normalized Euclidean distance between two sequences of length m is, in effect, a function of the correlation between the two sequences as given below:_  
\[d_{x,y}=\sqrt{2m\big{(}1-corr(x,y)\big{)}} \tag{12}\]  
_where \(d\) is the z-normalized Euclidean distance between two sequences \(x\) and \(y\), \(m\) is the length of the two sequences \(x,y\) and corr() is the Pearson correlation coefficient between the two sequences \(x,y\)._  
Proof. : First, we illustrate the following properties of the inner product of the z-normalized sequence:  
\[\sigma_{x\sum_{i}^{m}(x_{i}-mx)^{2}}^{2} \tag{13}\]  
where \(\sigma_{x}^{2}\) is the variance of the sequence \(x\). \[d(x,y)^{2}=\sum_{i}^{m}\Big{(}\frac{x_{i}-mx}{\sigma x}\Big{)}^{2} \tag{14}\]  
Using Equation (14), a function of the correlation between the two sequences can be proved as:  
\[d(x,y)^{2} =\sum_{i}^{m}\Big{(}\frac{x_{i}-mx}{\sigma x}-\frac{y_{i}-my}{ \sigma y}\Big{)}^{2}\] \[d(x,y)^{2} =\sum_{i}^{m}\Big{(}\frac{x-mx}{\sigma x}\Big{)}^{2}-2\sum_{i}^{ m}\Big{(}\frac{x-mx}{\sigma x}\Big{)}\sum_{i}^{m}\Big{(}\frac{y-my}{\sigma y} \Big{)}+\sum_{i}^{m}\Big{(}\frac{y-my}{\sigma y}\Big{)}^{2}\] \[d(x,y)^{2} =2m\Big{(}1-\frac{1}{m}\sum_{i}^{m}\Big{(}\frac{x-mx}{\sigma x} \Big{)}\Big{)}2m\Big{(}1-\frac{1}{m}\sum_{i}^{m}\Big{(}\frac{x-mx}{\sigma x} \Big{)}\Big{)} \tag{15}\] \[d(x,y)^{2} =2m\Big{(}1-corr(x,y)\Big{)}\] \[d(x,y) =\sqrt{2m\Big{(}1-corr(x,y)\Big{)}}\]  
The correlation property between the two sequences given in Equation (13) is proved. Thus, Equation (15) shows equality. The Pearson correlation coefficient (PCC) calculates the strength of the linear association between two variables. Let x and y be random variables. The PCC is defined as:  
\[corrx,y=\frac{\Big{(}E(x)-mx\Big{)}\Big{(}E(y)-my\Big{)}}{\sigma_{xy}} \tag{16}\] \[=\frac{\sum_{i=1}^{m}Q_{x,y}-m_{x,y}y}{m\sigma_{x}\sigma_{y}}\]  
where \(E\) is the expected distance between the two sequences \(x\) and \(y\) and \(Q_{x,y}\) is the dot product of time series \(T_{x,m}\) and \(T_{y,m}\). The proposed connection of the z-normalized Euclidean distance with the Pearson correlation coefficient is expressed by the following equation:  
\[ \begin{array}{l}d_{x,y}=\sqrt{2m\Big{(}1-corr(x,y)\Big{)}}\\ =\sqrt{2m\Big{(}1-\frac{Q_{x,y}-m\mu_{x}\mu_{y}}{m\sigma_{x}\sigma_{y}}\Big{)}} \end{array}  \tag{17}\]  
\(\square\)  
**Definition 3**. : _The z-normalized Euclidean distance \(d_{x,y}\) of two time series subsequences \(T_{x,m}\) and \(T_{y,m}\) can be evaluated as follows:_  
\[d_{x,y}=\sqrt{2m\Big{(}1-\frac{Q_{x},y-m\mu_{x}\mu_{y}}{m\sigma_{x}\sigma_{y}} \Big{)}} \tag{18}\]  
_where \(\mu_{x}\) is the mean of \(T_{x,m}\), \(\mu_{y}\) is the mean of \(T_{y,m}\), \(\sigma_{x}\) is the standard deviation of \(T_{x,m}\) and \(\sigma_{y}\) is the standard deviation of \(T_{y,m}\)._  
Considering that the correlation is limited to the range \([-1,1],d_{x,y}\) can fall within the range \([0,2\sqrt{m}]\) between two sequences of length \(m\), where zero implies an ideal match and \(2\sqrt{m}\) corresponds to the worst possible match. As a consequence, the upper bound of \(2\sqrt{m}\) can be used to normalize distances to the range \([0,1]\), which can help us to equate matches of different lengths and enable us to identify and repeat thresholds to define degrees of resemblance by using \(d_{x,y}\).