Similarity - mtpearce/idyom GitHub Wiki
This app uses IDyOM to estimate the dissimilarity between pairs of compositions using compression distance. Roughly speaking, one composition is used to train a model and the resulting model is then used to estimate how well it predicts another composition. If the second composition is well predicted by the first, then the two are treated as more similar.
For more information see:
Pearce, M. T., & Müllensiefen, D. (2017). Compression-based modelling of musical similarity. Journal of New Music Research.
The top-level function is similarity:idyom-dissimilarity. It has four required arguments. These are positional arguments and should be supplied in the following order:
-
dataset-ids-1: a list of dataset ids designating the first set of compositions -
dataset-ids-2: a list of dataset ids designating the second set of compositions -
target-viewpoints: a list of basic viewpoints to predict -
source-viewpoints: a list of viewpoints used in prediction
Each composition in the first set is compared with each composition in the second set. The function returns a list of rows containing the composition ids, descriptions and similarity values. If :output-path is supplied, the same information is also written to a file.
Useful optional parameters are:
-
output-path: a directory in which to write the output file -
overwrite: whether an existing output file should be overwritten (defaultt); ifnil, an existing file is preserved -
ltmo,stmo: model options for the long- and short-term models -
symmetric: ift(the default), the distance is made symmetric by comparing the two directions and taking the larger value; ifnil, only the first-to-second direction is used -
normalised: ift, a normalised compression distance is returned; ifnil(the default), the unnormalised distance is returned
The following is an example:
This compares every composition in dataset 0 with every composition in dataset 1. The model predicts cpitch and uses the source viewpoints cpintfref and cpint in doing so.
CL-USER> (similarity:idyom-dissimilarity '(0) '(1) '(cpitch) '(cpintfref cpint))
The following example writes normalised symmetric distances to a file:
In this case, the same pair of datasets is compared, but the distances are normalised, made symmetric and written to /tmp/.
CL-USER> (similarity:idyom-dissimilarity '(0) '(1) '(cpitch) '(cpintfref cpint)
:normalised t :symmetric t :output-path "/tmp/")