Cluster Analysis–Part 2

—

by

in

Before using cluster analysis to see whether musical styles emerge naturally from the Skiptune database, we first needed to answer a more basic question: What characteristics of a tune should the computer measure?

34 Metrics

Early on in the Skiptune project, as we were entering tunes, we found ourselves wondering if certain patterns we were seeing were worth keeping track of. For instance, some tunes had a lot of the same pitches following one another, sometimes many times in a row. Other tunes seemed to have no pitches following each other, and instead would have an interval. We started keeping track of these as metrics and documented the 34 we came up with Comparing Tunes Using Metrics

Those metrics proved their worth in the creation of Chernoff faces. However, we created them by noticing interesting patterns as we were entering tunes, not in any systematic way. It is now time to to audit the existing 34-metric system for completeness, symmetry, implementation quality and redundancy. When that’s complete, we will add only the dimensions that were genuinely missing; and then prune the enlarged candidate set for redundancy.

Here are dthe original 34 metrics:

#Original metric
1Number of Patterns Within a Tune As Percent of Notes
2Number of Single-occurrence Patterns in Tune
3Single-occurrence Patterns As Percent of Tune Patterns
4Single-occurrence Patterns As Percent of Notes
5Number of Rests per Note
6Absolute Pitch Change Average
7Relative Pitch Change Average
8Use of Common Patterns
9Use of Rare Patterns
10Range of Pitches
11Average Duration Ratio
12Number of Runs Per Note
13Average Run Length
14Max Run Length
15Repetitive Note Durations
16Repetitive Note Pitches
17Spread of Two-Note Pattern Frequencies, Weighted
18Spread of Two-Note Pattern Frequencies, Unweighted
19Pick-up Duration
20Pick-up Percent
21Average Duration Ratio Going to Rests
22Average Duration Ratio Coming from Rests
23Number of Different Pitches
24Number of Different Pitch Differentials
25Number of Different Durations
26Number of Different Duration Ratios
27Normalized Number of Different Pitches
28Normalized Number of Pitch Differentials
29Normalized Number of Durations
30Normalized Number of Duration Ratios
31Number of Repeated Intervals
32Number of Repeated Duration Ratios
33Percent of 3-Note Palindromes
34Percent of Tunes with Same Individual Patterns

Putting the Original Metrics into Families

The first step is conceptual rather than statistical. We group the metrics by the musical phenomenon they were intended to describe. This makes two things easier to see: Where several metrics were competing to describe the same phenomenon, and where an analogous musical dimension was missing.

FamilyOriginal metricsWhat the family measures
Pattern vocabulary / rarity1, 2, 3, 4, 8, 9, 17, 18, 34Pattern diversity, rarity, commonness and corpus sharing
Rests5How much silence is present
Pitch vocabulary / range10, 23, 27Registral span and diversity of pitch vocabulary
Pitch movement / contour6, 7, 12, 13, 14, 24, 28, 31, 33Magnitude, interval vocabulary, persistence and local contour
Repeated pitch16Immediate pitch repetition
Rhythm / duration11, 15, 21, 22, 25, 26, 29, 30, 32Duration change, repetition, vocabulary and behavior around rests
Pickup / opening structure19, 20Anacrusis behavior

To some extent, these categories are arbitrary. When a metric could reasonably be put into two or more categories, we had to pick one. For instance, “Rests” has just one metric (#5), but two of the Rhythm/duration metrics also include rests (#21 and #22). While we put them in the Rhythm/duration category, we must recognize that as a judgment call and that they could alsos have been placed into the Rests category.

What Was Missing from the Original 34 Metrics

The family audit showed that the original 34 were already broad, but they were not fully symmetrical or complete. The largest gaps were in duration movement and tonality.

Pitch had explicit run metrics (number of runs, average run length and maximum run length), but duration did not. Pitch and duration also lacked a clean pair of directional-change measures. Finally, the original system had no compact family explicitly describing tonal organization. Those omissions motivated Metrics 35–43.

#Added metricWhy it was added
35Absolute Average Duration ChangeAdded as a cleaner measure of the magnitude of rhythmic movement and as a duration-side counterpart to pitch-movement magnitude.
36Number of Duration Runs per NoteAdded for symmetry with pitch Metric 12, Number of Runs Per Note.
37Average Duration Run LengthAdded for symmetry with pitch Metric 13, Average Run Length.
38Maximum Duration Run LengthAdded for symmetry with pitch Metric 14, Max Run Length.
39Ascending Pitch ChangesAdded to represent direction of pitch movement explicitly rather than only magnitude, range or persistence.
40Increasing Duration ChangesAdded as the rhythmic directional counterpart to Metric 39.
41Diatonic Pitch PercentageAdded to supply an explicit measure of conformity to a diatonic pitch collection.
42Tonic EmphasisAdded to measure concentration on the inferred tonic, a tonal property not captured by range or contour.
43Pitch-Class EntropyAdded to measure concentration versus dispersion of pitch-class usage, completing a small tonal family.

The enlarged candidate pool therefore contained 43 metrics: the original 34 plus nine deliberately chosen additions. The purpose of expansion was not to create more variables for their own sake. It was to make the candidate set sufficiently complete and symmetrical that pruning would be based on evidence rather than on omissions in the starting design.

Normalization Rule

While reviewing implementation, we adopted an important rule. When a metric is normalized for tune length, the denominator is based on the original tune events, not on a shortened derived sequence after rests or other events have been removed. The point of normalization is to prevent a long tune from receiving more opportunities to accumulate events merely because it is long. We don’t want to redefine the size of the composition after preprocessing as that would add an artificial distortion. Where a transition count naturally has n−1 opportunities, n−1 is appropriate, where n refers to the length of the original event sequence.

Next week we tackle the selection of which metrics we should keep for the purpose of cluster analysis, as well as any other analysis we might do where redundancy needs to obe considered.