## 5 Basic Experiments
### Neural Network with Triplet Loss  
As the third approach, we applied dimensionality reduction with a deep neural network (DNN) as described in Section 4.3. For training the neural network, we used triplets of shingles from the training set \(\mathbb{D}_{1}\). They were generated with the constraint that the central time positions of the anchor and positive shingles corresponded to the same musical position in different versions of the same piece. The negative shingle did not musically correspond to the anchor shingle. To generate such musically meaningful triplets, we needed to compute musically corresponding time positions in all versions of the same pieces in a pre-processing stage. We used a dynamic-time-warping-based music synchronization approach [7] (Chapter 3) for this purpose. Furthermore, random circular shifts along the chroma axis were applied to avoid biasing the network towards the musical keys in our data set. The shifts applied to the anchor and the positive examples were the same, while the shift applied to the negative example was chosen independently. This triplet generation procedure led to a combinatorial explosion of possible triplets. For that reason, not all possible triplets were provided to the network during training. We defined an \"epoch\" to consist of 2000 batches with a batch size of 128 triplets, used for batch gradient descent with the Adam optimizer [55]. Other triplet loss studies sometimes control the triplet generation by a specific procedure called \"semi-hard triplet mining\" [33]. Preliminary experiments (not reported here) showed that in our case, there were no improvements by this method. Therefore, we do not apply this procedure in the experiments reported in this paper. In our first experiments, we fixed \(\alpha=1.3\) (see Section 5.6 for a discussion) as well as a learning rate of \(10^{-3}\) and trained a neural network for 10 epochs. It turned out that a larger number of epochs did not improve the retrieval results.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{3}{c}{**GRO**[12]} & \multicolumn{3}{c}{**PCA**} \\ \(K\) & **P@1** & \(\mathbf{P_{R}}\) & **MAP** & **P@1** & \(\mathbf{P_{R}}\) & **MAP** \\ \hline
40 & 0.930 & 0.773 & 0.832 & 0.991 & 0.926 & 0.964 \\
60 & 0.975 & 0.871 & 0.921 & 0.993 & 0.938 & 0.971 \\
80 & 0.987 & 0.903 & 0.948 & 0.994 & 0.942 & 0.973 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Retrieval results for principle component analysis (PCA)-based dimensionality reduction of individual chroma vectors (GRO) [12] and entire shingles (PCA, proposed) using the test set \(\mathbb{D}_{2}\).  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{3}{c}{**PCA**} & \multicolumn{3}{c}{**DNN**} \\ \(\mathbf{K}\) & **P@1** & \(\mathbf{P_{R}}\) & **MAP** & **P@1** & \(\mathbf{P_{R}}\) & **MAP** \\ \hline
3 & 0.603 & 0.550 & 0.580 & 0.671 & 0.647 & 0.683 \\
4 & 0.807 & 0.714 & 0.754  
Columns 5-7 of Table 5 show the evaluation results for a range of different dimensionalities from 3 to 30 using the test set \(\mathbb{D}_{2}\). In general, the retrieval quality increases with an increase of \(K\) from an MAP value of 0.683 for \(K=3\) to 0.959 for \(K=30\). Let us consider some cases as examples. For \(K=6\), the P@1 value is 0.890, i.e., for 363 of the 3300 queries, the top-ranked document was not relevant. For \(K=12\) (P@1: 0.964), this is the case for only 119 queries. Compared to the PCA-based approach, the neural network especially improved the retrieval results for smaller dimensionalities like 6 or 8, where the MAP value is greater by more than 0.08 (e.g., \(K=8\), MAP for PCA: 0.806 and for DNN: 0.898). We observed rather small improvements in P@1, but there was a considerable increase of \(\mathrm{P}_{R}\) (e.g., \(K=8\), \(\mathrm{P}_{R}\) for PCA: 0.754 and for DNN: 0.856).