# An Application of the Associate Hopfield Network for Pattern Matching in Chart Analysis
## 4 Experiment
### Results  
#### 4.2.1 Six Stored Patterns  
Table 1 summarizes the differences of each matching method. The distance-based methods, ED, DTW and PIP-VD, require a predefined threshold to decide whether to accept the matching pattern. Segmentation means the methods require a data preprocessing procedure to extract the important data points. Training represents the methods that need to be trained. The proposed matching approach is compared with three different distance-based methods: ED, DTW and PIP-VD. We choose the first six templates as the stored patterns of the LAHN. We generate the synthetic data of the 11 patterns shown in Figure 9. Each template pattern would generate 200 samples. The length of each generated time-series data is the width of the sliding window and we temporally set it to be 49. Table 2 shows the accuracy of each model applied on the first 6 templates (H&S, Tria-A, CWH, Reverse CWH, Trip-B, Doub-T). We conduct the experiment on the normal data and noisy data, the standard deviation \(\sigma\) in the noise adding process of the normal data is 0.15 while it is 0.2 in the noisy data. As for the time-warping process, we change the position of data point \(x_{i}\) within the range of \(\frac{2}{3}[x_{i-1},x_{i+1}]\) in the normal dataset, and set the range to \([x_{i-1},x_{i+1}]\) in the noisy dataset. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Segmentation** & **Training** & **Threshold** \\ \hline ED & \(\times\) & \(\times\) & \(\checkmark\) \\ DTW & \(\times\) & \(\times\) & \(\checkmark\) \\ PIP-VD & \(\checkmark\) & \(\times\) & \(\checkmark\) \\ PIP-TG & \(\checkmark\) & \(\checkmark\) & \(\times\) \\ N-equal-part TG & \(\checkmark\) & \(\checkmark\) & \(\times\) \\ Scaling PIP & \(\checkmark\) & \(\checkmark\) & \(\times\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The characteristics of each models. In the above experiment, the threshold of the ED approach is set to be 3, and DTW is 17. We scale the template pattern to the same size as the synthetic data in these two methods. Once the difference measured by the model is lower than the predefined threshold, the distorted time series would be matched to the most similar template pattern. The parameters of the LAHNs are summarized in Table 11. As is shown in Table 2, the ED approach is quite sensitive to the noise level of the data, while the accuracy of the other 5 methods is changed within an acceptable range. In our proposed method, the scaling PIP has the best overall matching accuracy, and the PIP-TG is slightly better than the traditional PIP. As for the training process, it only takes a few seconds to train a LAHN. DTW got the best performance over the other methods, but it requires more processing time as the data size increases. The results in Figure 10 show that the consuming time of DTW grows with the scale of the time series. However, with the segmentation, the processing time of the other 4 methods (except ED) only has a small change. The N-equal-part method costs a bit more time because the LAHN has more neurons compared to the one used in the other representation. Table 3 shows the matching results of each template pattern. The synthetic data is generated with three noise levels here, and the position of the data points would be changed within the range \([x_{i-1},x_{i+1}]\) in the time-warping process. Although the PIP method has a good performance in some patterns such as H&S, Tria-A, and Trip-B, its overall accuracy is not the best. With more information on the time series, the DTW method got the best overall performance. The scaling PIP performs slightly worse than DTW, but as described above, it has an advantage in terms of processing time. \begin{table}
\begin{tabular}{l c c c c c c} \hline \hline
**Model** & **ED** & **DTW** & **PIP-VD** & **PIP-TG** & **N-Equal-Part TG** & **Scaling PIP** \\ \hline Noisy data & 0.557 & 0.919 & 0.806 & 0.803 & 0.825 & 0.913 \\ Normal data & 0.897 & 0.998 & 0.868 & 0.874 & 0.940 & 0.960 \\ \hline \hline \end{tabular}
\end{table}