## 2 The Symbolic Compositional Hierarchical Model
### Model Description
#### 2.1.2 Activations: Occurrences of Patterns  
An activation of a part corresponds to the presence of the concept it encodes (melodic pattern in SymCHM) in the model input. An activation has three components: location and onset time, which map the relative pattern representation onto a specific MIDI (Musical Instrument Digital Interface technical standard) pitch and a time position within the input sequence of events (thus making it absolute) and magnitude, representing its strength. A part will activate at a given location if all of its subparts are activated with magnitude greater than zero (this condition is relaxed with hallucination, which we introduce later in this section). A part  
Figure 1: The symbolic compositional hierarchical model. The input layer corresponds to a symbolic music representation (a sequence of pitches). Parts on higher layers are compositions of lower-layer parts (depicted as connections between parts, the parameter \(\mu\) is given in semitones). The structure of a part is displayed above each part in the figure, represented by a sequence of pitch values relative to the first subpart (e.g., [0,0,1] for the part \(P_{1}^{2}\)). A part may be contained in several compositions, e.g., \(P_{M_{i}}^{1}\) is a part of compositions \(P_{2}^{2}\) and \(P_{3}^{2}\). The entire structure is transparent, thus we can observe the entire sub-tree of the part \(P_{1}^{4}\). A part activates, when (a part of) the pattern it represents is found in the input. As an example, \(P_{1}^{4}\) activates twice (Inputs A and B), however there are differences in the found patterns. Pattern A is positioned five semitones higher than B; Pattern B is missing one event (dotted green rectangle); and the pitch of one event (blue rectangle) differs between the two patterns. can concurrently activate at different locations and times, which indicates multiple occurrences of its concept in the input representation. In terms of the repeated pattern discovery task, each activation of a part can be observed as a pattern occurrence: a repetition of the pattern encoded by the observed part. More formally, the activation \(A\) is defined as a triplet \(\langle A_{L},A_{T},A_{M}\rangle\) of location, time and magnitude. The activation location \(A_{L}\) and the time \(A_{T}\) of the part \(P_{i}^{n}\) are defined as:  
\[ \begin{split} A_{L}(P_{i}^{n})&=A_{L}(P_{k_{0}}^{n -1})\\ A_{T}(P_{i}^{n})&=A_{T}(P_{k_{0}}^{n-1}).\end{split}  \tag{2}\]  
The compositions therefore propagate their locations and onset times upwards through the hierarchy. Such propagation can be usefully employed as an indexing mechanism and allows for a top-down analysis of activations. The activation magnitude represents the strength of the composition's match with the input and is defined as a weighted sum of subpart magnitudes:  
\[A_{M}(P_{i}^{n})=\tanh\left(\tfrac{1}{k}\sum_{j=0}^{K-1}w_{j}A_{M}(P_{k_{j}}^{ n-1})\right), \tag{3}\]  
where the weights \(w_{j}\) are defined by the match between the learned and the observed relative subpart pitch locations and bounded by the difference in their activation times:  
\[w_{j} = \begin{cases}1:&j=0\\ \mathcal{N}(\delta_{Lj},\mu_{j},\sigma_{j}):&j>0\wedge\delta_{Tj}<\tau_{W}\\ 0:&\delta_{Tj}\geq\tau_{W}\\ \delta_{Lj}&=A_{L}(P_{k_{j}}^{n-1})-A_{L}(P_{k_{0}}^{n-1})\\ \delta_{Tj}&=A_{T}(P_{k_{j}}^{n-1})-A_{T}(P_{k_{0}}^{n-1})\\ \end{cases} . \tag{4}\]  
The motivation behind the usage of _tanh_ function introduced in Equation (3) is retained from neural-network-based architectures: it provides a saturated output with the maximum limited to one. Any other function could be used to calculate the magnitude of the activation, but the hyperbolic tangent function possesses several interesting properties: it is a monotonically increasing function with a smooth gradient and has a value close to one as it approaches infinity. Since the activation magnitudes are directly used to calculate activations on a higher layer, the output of the function needs to be normalized.