Package: repytah
A Python package that builds aligned hierarchies for sequential data streams.DocumentationSee ourwebsitefor a complete reference manual and introductory tutorials.Thisexampletutorial will show you a usage of the package from start to finish.SummaryWe introducerepytah, a Python package that constructs the aligned hierarchies representation that contains all possible structure-based hierarchical decompositions for a finite length piece of sequential data aligned on a common time axis. In particular, this representation--introduced by Kinnaird [@Kinnaird_ah] with music-based data (like musical recordings or scores) as the primary motivation--is intended for sequential data where repetitions have particular meaning (such as a verse, chorus, motif, or theme). Although the original motivation for the aligned hierarchies representation was finding structure for music-based data streams, there is nothing inherent in the construction of these representations that limitsrepytahto only being used on sequential data that is music-based.Therepytahpackage builds these aligned hierarchies by first extracting repeated structures (of all meaningful lengths) from the self-dissimilarity matrix (SDM) for a piece of sequential data. Intentionallyrepytahuses the SDM as the starting point for constructing the aligned hierarchies, as an SDM cannot be reversed-engineered back to the original signal and allows for researchers to collaborate with signals that are protected either by copyright or under privacy considerations. This package is a Python translation of the original MATLAB code by Kinnaird [-@Kinnaird_code] with additional documentation, and the code has been updated to leverage efficiencies in Python.Problems AddressedSequential data streams often have repeated elements that build on each other, creating hierarchies. Therefore, the goal ofrepytahis to extract these repetitions and their relationships to each other in order to form aligned hierarchies.To learn more about aligned hierarchies, see thispaperby Kinnaird (ISMIR 2016) which introduces aligned hierarchies in the context of music-based data streams.AudiencePeople working with sequential data where repetitions have meaning will findrepytahuseful including computational scientists, advanced undergraduate students, younger industry experts, and many others.An example application ofrepytahis in Music Information Retrieval (MIR), i.e., in the intersection of music and computer science.InstallationThe latest stable release is available on PyPI, and you can install it by running:pipinstallrepytahIf you use Anaconda, you can install the package usingconda-forge:condainstall-cconda-forgerepytahTo build repytah from source, saypython setup.py build.
Then, to install repytah, saypython setup.py install.Alternatively, you can download or clone the repository and usepipto handle dependencies:unziprepytah.zip
pipinstall-erepytah-mainorgitclonehttps://github.com/smith-tinkerlab/repytah.git
pipinstall-erepytahBy callingpip listyou should seerepytahnow as an installed package:repytah(0.x.x,/path/to/repytah)Current and Future Work - Elements of the PackageAligned Hierarchies - This is the fundamental output of the package, of which derivatives can be built. The aligned hierarchies for a given sequential data stream is the collection of all possiblehierarchicalstructure decompositions,alignedon a common time axis. To this end, we offer all possible structure decompositions in one cohesive object.Includes walk through fileexample.pyusing suppliedinput.csvForthcomingAligned sub-Hierarchies - (AsH) - These are derivatives of the aligned hierarchies and are described inAligned sub-Hierarchies: a structure-based approach to the cover song taskForthcomingStart-End and S_NL diagramsForthcomingSuPP and MaPP representationsMATLAB codeThe original code to this project was written in MATLAB by Katherine M. Kinnaird. It can be foundhere.AcknowledgementsThis code was developed as part of Smith College's Summer Undergraduate Research Fellowship (SURF) from 2019 to 2022 and has been partially funded by Smith College's CFCD funding mechanism. Additionally, as Kinnaird is the Clare Boothe Luce Assistant Professor of Computer Science and Statistical & Data Sciences at Smith College, this work has also been partially supported by Henry Luce Foundation's Clare Boothe Luce Program.Additionally, we would like to acknowledge and give thanks to Brian McFee and thelibrosateam. We significantly referenced the Python packagelibrosain our development process.CitingPlease citerepytahusing the following:C. Jia et al., repytah: A Python package that builds aligned hierarchies for sequential data streams. Python package version 0.1.2, 2023. [Online]. Available:https://github.com/smith-tinkerlab/repytah.