Running IDyOM Tutorial

This tutorial will walk you through how to run the IDyOM model in py2lispIDyOM. For an overview of the py2lispIDyOM functionality, see the README.

Generally speaking, to run the IDyOM model with py2lispIDyOM usually takes three steps:

  1. Set experiment configuration (paths to input music files and to output experiment log.

  2. Set model configuration (model parameters, see IDyOM parameters documentation for more detail).

  3. Run the experiment.

In this sample experiment, - we will have the model pretrain on a chinese corpus (‘shanx_dataset/’) and test the model on the european corpus (‘bach_dataset/’).

  • the viewpoints to predict (target viewpoint) and the viewpoints to use in prediction (source viewpoint) are both cpitch and onset.

  • we will use the ‘:both’ model, and we don’t want resampling (i.e., k=1).

Step-by-Step

[1]:
#  import relevant modules
import py2lispIDyOM as py2lispIDyOM
from py2lispIDyOM.run import IDyOMExperiment

1. Set experiment configuration:

First, we set the IDyOM experiment configurations by providing the relevant paths to the IDyOMExperiment.

class IDyOMExperiment(test_dataset_path,
                      pretrain_dataset_path=None,
                      experiment_history_folder_path=None)
[2]:
my_experiment = IDyOMExperiment(test_dataset_path='dataset/bach_dataset/',
                                pretrain_dataset_path='dataset/shanx_dataset/')
** Putting Test dataset files in experiment history folder. **
** Putting Pretraining dataset files in experiment history folder. **

2. Set model parameters:

Next, we set the model parameters using the set_parameters methods.

class IDyOMExperiment.set_parameters(target_viewpoints, source_viewpoints,
                                     ...)

For a comprehensive list of valid model parameters, see below and also the documentation:

Valid parameters are: [‘ltmo_order_bound’, ‘ltmo_mixtures’, ‘ltmo_update_exclusion’, ‘ltmo_escape’, ‘stmo_order_bound’, ‘stmo_mixtures’, ‘stmo_update_exclusion’, ‘stmo_escape’, ‘detail’, ‘overwrite’, ‘separator’, ‘target_viewpoints’, ‘source_viewpoints’, ‘models’, ‘ltmo’, ‘ltmo_options’, ‘stmo’, ‘stmo_options’, ‘k’, ‘resampling_indices’, ‘basis’, ‘dp’, ‘max_links’, ‘min_links’, ‘viewpoint_selection_output’, ‘use_resampling_set_cache’, ‘use_ltms_cache’

For detailed description of the model parameters, please refer to the IDyOM parameters documentation.

[3]:
my_experiment.set_parameters(target_viewpoints=['cpitch', 'onset'],
                             source_viewpoints=['cpitch', 'onset'],
                             models=':both',
                             k=1,
                             detail=3)

3. Run IDyOM model:

To run the IDyOM model, simply call the IDyOMExperiment.run() method.

[4]:
my_experiment.run()
** running lisp script **
To load "clsql":
  Load 1 ASDF system:
    clsql
; Loading "clsql"
.
To load "idyom":
  Load 1 ASDF system:
    idyom
; Loading "idyom"
...........

Inserting data into database: dataset 66052122170523.
Inserting data into database: dataset 99052122170523.
Written resampling set to /Users/guan/idyom/data/resampling/66052122170523-1.resample.
Written PPM* model to /Users/guan/idyom/data/models/cpitch_99052122170523_66052122170523-1:1_melody.ppm.
Written PPM* model to /Users/guan/idyom/data/models/onset_99052122170523_66052122170523-1:1_melody.ppm.

** Finished! **
[ ]:

What happens then?

py2lispIDyOM will automatically create a folder (with the timestamp of experiment time as the folder name) logging all data of the current experiment. For details of the experiment log folder, see the Experiment Logger section in README.

After finish running the model, the model output (a .dat file will be saved in the current experiment log folder under ‘experiment_output_data_folder/’).

From here on, you can extract the relevant IDyOM outputs or export them in other formats for further analysis.

[ ]:

[ ]:

[ ]:

[ ]:

[ ]: