## 3 Proposed Novel Matrix Profile for Similarity Search
### Distance Determination & Matrix Profile Index (DD & MPI)  
This index is the output value of the distance determination and index detection neighbor nodes. Indexing makes it possible for large-scale databases to provide an accessible organization of data for fast retrieval. Figure 3 shows the three types of time series data that are arranged according to their characteristics, but a few time series data sets are out of reach of the neighbor nodes. Thus, such data sets are confirmed outliers and anomalies. Different confidence intervals demonstrate the probability, which comes from different samples available in the dataset. It is important to carefully describe the difference between time series data sets to show perceptually significant aspects of the underlying similarity. Finally, the indexing mechanism must allow ever-growing large data sets to be handled and queried effectively. The immediate neighbor detection process is further described in Algorithm 2. Figure 3: Determination of confirmed outliers and anomalies for time series data sets. ```
0:\(\left\{T_{inf}\right\}\) in
0:\(\left\{I_{ne}\right\}\) out
1:Initialization: {\(T_{inf}\): Time series, \(T_{l}\): Time series length, \(M_{s}\): Set the memory, M: Memory, \(M_{i}\): Initial matrix profile, \(M_{p}\): Matrix profile index vector, \(M_{p}\): Mean values of time series, \(S_{ts}\): Subsequence from time series \(T_{s}\), \(I_{ne}\): Location of neighbor }
2:Compute \(T_{l}\in T_{inf}\)
3:Initialize \(M_{s},M_{i}\gets infs,M_{pi}\gets zeros\)
4:Allocate \(M\in M_{i}\)&\(M_{pi}\)
5:Compute \(M_{v}=\frac{1}{T_{l}}\sum Tinf_{i}\)
6:Compute \(\mu==\left(T_{inf_{i}}-M_{v}\right)^{2}\)&\(\sum_{t=1}^{T_{l}}\left(T_{inf_{i}}-M_{v}\right)^{2}\frac{1}{T_{l}}\sum_{t=1}^{T_{l}} \left(T_{inf_{i}}-M_{v}\right)^{2}\)
7:Compute \(\sigma=\sqrt{\frac{1}{T_{l}}\sum_{inf_{i}}^{2}-\mu^{2}}\)
8:Determine \(M_{pi}\) using \(M_{v},\mu,\sigma\) from \(T_{inf}\)
9:while\(M_{pi}\leq T_{inf}\)do
10:if\(M_{pi}=T_{l}\)then
11: Store \(I_{ne}[i]=M_{pi}\)
12:endif
13:endwhile
```  
**Algorithm 2** Immediate Neighbor Detection Process  
Algorithm 2 determines the immediate neighbor detection process. In step 1, the variables used in the algorithm are initialized. The input and output are shown at the beginning of the algorithm. In step 2, the length of the time series is calculated. In steps 3-4, we set and allocate the memory. In steps 5-7, we determine the mean values and the standard deviation of the time series. In steps 8-13, we calculate and save the location of each neighbor. The output of the algorithm is the matrix profile index. In the basic method, we want to locate the nearest neighbor of every subsequence in \(T\). The nearest neighbor information is stored in two meta time series, the matrix profile and the matrix profile index. As the name suggests, the matrix profile is a profile that stores the minimum Euclidean distance of every subset of one time series with respect to another (or itself, called self-joining). It additionally stores an associate vector called the profile index that gives the index of each nearest neighbor. The profile index \(I_{ne}\) stores indices and therefore integers. The remaining meta time series are all real values and are stored as floating point values. Floating point stored values can be determined as:  
\[V_{f}=\left(T_{l}-u+1\right)\cdot 4+u-1 \tag{32}\]  
where \(V_{f}\) are floating point stored values, \(n\) is the length of time series \(Tl\), and m is the fixed length for each subsequence \(T_{i,m}\). The next equation defines the values required for the remaining meta time series of integer values:  
\[V_{i}=Tl-u+1 \tag{33}\]  
where \(V_{i}\) are stored integer values. Dismissing the exclusion zone \(E_{i}\) of trivial matches, the matrix profile denotes a vector whose elements are the minima of the columns in the distance matrix. Matrix profile computation can be determined as:  
\[m_{pi}=min\left(d_{i,j}\right) \tag{34}\]where \(m_{pi}\) is the matrix profile.