# 2020:Patterns for Prediction Results

## Contents

## Introduction

**In brief**:

We look for

(1) Algorithms that take an excerpt of music as input (the prime), and output a predicted continuation of the excerpt.

(2) Additionally or alternatively, algorithms that take a prime and one or more continuations as input, and output the likelihood that each continuation is the genuine extension of the prime.

**In more detail**: One facet of human nature comprises the tendency to form predictions about what will happen in the future (Huron, 2006). Music, consisting of complex temporally extended sequences, provides an excellent setting for the study of prediction, and this topic has received attention from fields including but not limited to psychology (Collins, Tillmann, et al., 2014; Janssen, Burgoyne and Honing, 2017; Schellenberg, 1997; Schmukler, 1989), neuroscience (Koelsch et al., 2005), music theory (Gjerdingen, 2007; Lerdahl & Jackendoff, 1983; Rohrmeier & Pearce, 2018), music informatics (Conklin & Witten, 1995; Cherla et al., 2013), and machine learning (Elmsley, Weyde, & Armstrong, 2017; Hadjeres, Pachet, & Nielsen, 2016; Gjerdingen, 1989; Roberts et al., 2018; Sturm et al., 2016). In particular, we are interested in the way exact and inexact repetition occurs over the short, medium, and long term in pieces of music (Margulis, 2014; Widmer, 2016), and how these repetitions may interact with "schematic, veridical, dynamic, and conscious" expectations (Huron, 2006) in order to form a basis for successful prediction.

We call for algorithms that may model such expectations so as to predict the next musical events based on given, foregoing events (the prime). We invite contributions from all fields mentioned above (not just pattern discovery researchers), as different approaches may be complementary in terms of predicting correct continuations of a musical excerpt. We would like to explore these various approaches to music prediction in a MIREX task. For subtask (1) above (see "In brief"), the development and test datasets will contain an excerpt of a piece up until a cut-off point, after which the algorithm is supposed to generate the next N musical events up until 10 quarter-note beats, and we will quantitatively evaluate the extent to which an algorithm's continuation corresponds to the genuine continuation of the piece. For subtask (2), in addition to containing a prime, the development and test datasets will also contain continuations of the prime, one of which will be genuine, and the algorithm should rate the likelihood that each continuation is the genuine extension of the prime, which again will be evaluated quantitatively.

What is the relationship between pattern discovery and prediction? The last five years have seen an increasing interest in algorithms that discover or generate patterned data, leveraging methods beyond typical (e.g., Markovian) limits (Collins & Laney, 2017; MIREX Discovery of Repeated Themes & Sections task; Janssen, van Kranenburg and Volk, 2017; Ren et al., 2017; Widmer, 2016). One of the observations to emerge from the above-mentioned MIREX pattern discovery task is that an algorithm that is "good" at discovering patterns ought to be extendable to make "good" predictions for what will happen next in a given music excerpt (Meredith, 2013). Furthermore, evaluating the ability to predict may provide a stronger (or at least complementary) evaluation of an algorithm's pattern discovery capabilities, compared to evaluating its output against expert-annotated patterns, where the notion of "ground truth" has been debated (Meredith, 2013).

## Contribution

For a more detailed introduction to the task, please see 2020:Patterns for Prediction.

## Datasets and Algorithms

The Patterns for Prediction Development Dataset (PPDD-Jul2018) has been prepared by processing a randomly selected subset of the Lakh MIDI Dataset (LMD, Raffel, 2016). It has audio and symbolic versions crossed with monophonic and polyphonic versions. The audio is generated from the symbolic representation, so it is not "expressive". The symbolic data is presented in CSV format. For example,

20,64,62,0.5,0 20.66667,65,63,0.25,0 21,67,64,0.5,0 ...

would be the start of a prime where the first event had ontime 20 (measured in quarter-note beats -- equivalent to bar 6 beat 1 if the time signature were 4-4), MIDI note number (MNN) 64, estimated morphetic pitch number 62 (see p. 352 from Collins, 2011 for a diagrammatic explanation; for more details, see Meredith, 1999), duration 0.5 in quarter-note beats, and channel 0. Re-exports to MIDI are also provided, mainly for listening purposes. We also provide a descriptor file containing the original Lakh MIDI Dataset id, the BPM, time signature, and a key estimate. The audio dataset contains all these files, plus WAV files. Therefore, the audio and symbolic variants are identical to one another, apart from the presence of WAV files. All other variants are non-identical, although there may be some overlap, as they were all chosen from LMD originally.

The provenance of the Patterns for Prediction Test Dataset (PPTD) will **not** be disclosed, but it shares simiarlity with LMD and not from LMD, if you are concerned about overfitting.

There are small (100 pieces), medium (1,000 pieces), and large (10,000 pieces) variants of each dataset, to cater to different approaches to the task (e.g., a point-set pattern discovery algorithm developer may not want/need as many training examples as a neural network researcher). Each prime lasts approximately 35 sec (according to the BPM value in the original MIDI file) and each continuation covers the subsequent 10 quarter-note beats. We would have liked to provide longer primes (as 35 sec affords investigation of medium- but not really long-term structure), but we have to strike a compromise between ideal and tractable scenarios.

Submissions to the symMono implicit task are listed in Table 1. There were no submissions to the symPoly, audMono or audPoly variants of the tasks this year. The task captains prepared a first-order Markov model (MM) over a state space of measure beat and key-centralized MIDI note number. As in previous years, this served as a foil for the implicit subtask. As one of last year's submissions (GenDetect (EP1)) already reached almost-perfect accuracy on these foils, we also evaluate how well the submitted models can discriminate the true continuation from a foil generated by last year's best-performing music prediction model, CopyForward (see abstract).

Sub code | Submission name | Abstract | Contributors |
---|---|---|---|

Task Version | symMono - Task 2 | ||

EP1 | GenDetect | Jeff Ens, Philippe Pasquier | |

YH16 | PDMTransformer | Vane Wu, YuanLiang Dong, Yu Hong (Tencent Music) |

**Table 1. Algorithms submitted to the symMono task of Patterns for Prediction 2019 / 2020.**

## Results

We measure the performance of an algorithm to 2) decide which of two versions is the true or foil continuation, given a prime (implicit task). To evaluate performance at the implicit task, we measure accuracy as the number of correct decisions, divided by the total amount of decisions. (For mathematical definitions of the various metrics, please see 2020:Patterns_for_Prediction#Evaluation_Procedure.)

For reference purposes, we also include results of the submissions from 2019 (GenDetect).

### symMono

#### Implicit task: discriminate true and foil continuation

Observations | Accuracy | Mean Probability | Variance of Probability | ||
---|---|---|---|---|---|

Model | Foil | ||||

EP1 | Markov | 500.0 | 1.000 | 1.000 | 0.000 |

EP1 | CopyForward | 500.0 | 0.774 | 0.738 | 0.132 |

YH16 | Markov | 500.0 | 0.996 | 0.961 | 0.006 |

YH16 | CopyForward | 500.0 | 0.916 | 0.507 | 0.005 |

**Table 1.** Discrimination scores of the submitted algorithms.

## Discussion

This year's submission, PDMTransformer, is based on a Music Transformer encoding of musical events, and Xtreme Gradient Boost of various classifiers trained on the resulting features. It has higher accuracy for the distinction of true and foil continuations than GenDetect, last year's highest accuracy submission. It outputs similar probabilities for the CopyForward foils and true continuations (scoring, e.g., 0.96 probability for the foils and 0.97 to the true continuation), which explains the lower mean probability (resulting from normalization of the two probability scores) of PDMTransformer as compared to GenDetect.