A Topic Model for Melodic Sequences

Athina Spiliopoulou, Amos J. StorkeyICML 2012

TL;DR

This paper introduces the Variable-gram Topic Model, a novel approach to modeling melodic sequences by combining latent topic modeling with a sophisticated temporal model that captures variable-length contexts. The authors demonstrate that this model significantly outperforms existing methods in both next-step prediction and a new evaluation framework using Maximum Mean Discrepancy (MMD) of string kernels, suggesting it better captures the underlying structure of music.

What Problem Does This Paper Address?

Modeling musical melodies is a complex challenge. Music isn't just a sequence of notes; it has rich temporal structures and intricate dependencies between musical elements like rhythm, meter, and scale. Capturing these nuances, especially within a specific genre where underlying forms and styles exist, is difficult for traditional machine learning models. Existing approaches often struggle to balance the need to model long-range temporal dependencies with the ability to capture higher-level thematic or stylistic elements (topics). This paper aims to bridge this gap by creating a model that can learn both the "what" (topics) and the "how" (temporal context) of musical sequences.

Methods

The core contribution is the Variable-gram Topic Model. This model builds upon Latent Dirichlet Allocation (LDA) by replacing LDA's simple word distributions within topics with a more powerful Dirichlet Variable-Length Markov Model (Dirichlet-VMM).

Here's a breakdown:

  • Latent Topics: Similar to LDA, the model assumes each musical piece (document) is a mixture of latent "topics." These topics can represent stylistic elements, harmonic tendencies, or other higher-level musical characteristics.
  • Dirichlet-VMM: This is the novel component for modeling temporal dependencies. Instead of assuming fixed-order Markov chains (like bigrams or trigrams), the Dirichlet-VMM learns contexts of variable length. It uses a suffix tree structure where longer contexts are preferred if they are well-supported by data, and shorter contexts are used otherwise. This allows the model to adapt to the local structure of the music.
  • Coupling: The Variable-gram Topic Model couples these two ideas: each latent topic is itself represented by a Dirichlet-VMM, allowing for context-dependent note generation within that topic.
  • Evaluation: The authors introduce a novel evaluation method using Maximum Mean Discrepancy (MMD) of string kernels. This technique compares samples generated by the model to actual data sequences by measuring the distance between their distributions in a Reproducing Kernel Hilbert Space. This is complementary to traditional next-step prediction log-likelihood, as it directly assesses how well the model's generated sequences resemble the real data's substructures.

Datasets

The experiments were conducted on a dataset of 264 Scottish and Irish reels from the Nottingham Folk Music Database. This dataset is described as having pieces primarily in G major or D major, with a 4/4 meter. The data was represented as sequences of discrete symbols, where time was discretized into eighth-note intervals, and MIDI values were mapped to a 26-dimensional variable representing pitch (C4-B5) and special "silence" and "continuation" symbols.

Key Insights and Ideas

  • Temporal Structure is Crucial: The results strongly suggest that modeling temporal dependencies is more critical for melody generation than just using latent topics alone. Models that incorporate sophisticated temporal modeling (like the Dirichlet-VMM) consistently outperform those that don't, even if they have topics.
  • Variable Contexts Matter: The Variable-gram Topic Model's ability to learn variable-length contexts within topics is a key advantage. This flexibility allows it to adapt to the diverse temporal patterns found in music.
  • Topics Add Value, But Don't Replace Temporal Models: While latent topics do improve performance over non-topic models, they don't fully compensate for a weak temporal model. The best performance is achieved when both are combined effectively.
  • MMD as a Generative Evaluation Tool: The introduction of MMD with string kernels provides a valuable new way to assess generative models for discrete data. It offers insights into how well a model captures the underlying data distribution, complementing traditional predictive metrics.
  • Music Has Genre-Specific Structure: The qualitative analysis (Figure 6) shows that the model can learn to distinguish between musical keys (G vs. D major), indicating it captures genre-specific structural elements.

Key Results

  • Next-Step Prediction: The Variable-gram Topic Model achieved the highest average next-step prediction log-likelihood across various configurations (number of topics, tree depth) compared to LDA, Bigram Topic models, and Dirichlet-VMMs. For instance, the best performing Variable-gram model (Var-gram.De) achieved a log-likelihood of -0.9553 (S.2, K=50), significantly better than LDA (-2.0280) or Bigram (-1.6966) with the same number of topics.
  • MMD Evaluation: The MMD results mirrored the next-step prediction findings, with the Variable-gram Topic Model showing the smallest MMD values, indicating its generated samples are closest to the real data distribution.
  • Qualitative Analysis: The model demonstrated an ability to distinguish between musical keys (G vs. D) by allocating topics differently. It also showed that topics can learn context-dependent note preferences, adapting to upward or downward melodic movements.

Limitations and Future Work

  • Model Complexity: The Variable-gram Topic Model is more complex than simpler models like LDA or Bigram Topic models, potentially leading to longer training times.
  • Generalization vs. Underfitting: While MMD helps identify underfitting (models spreading probability mass to improbable configurations), it doesn't directly assess generalization properties.
  • Novelty in Music: The paper touches upon the aspect of novelty in music generation, suggesting that future work could explore how to generate novel yet musically coherent sequences, potentially by comparing models trained on different data subsets.
  • Further Exploration of Temporal Models: The success of the Dirichlet-VMM suggests that exploring even more sophisticated temporal modeling techniques could further enhance melodic sequence generation.

Summary updated

BibTeX
@inproceedings{spiliopoulou2012topic,
  author = {Athina Spiliopoulou and Amos J. Storkey},
  title = {{A Topic Model for Melodic Sequences}},
  booktitle = {International Conference on Machine Learning},
  year = {2012},
  url = {https://openreview.net/forum?id=SyWUaiZubB},
}
Figure