Resampling » History » Version 2

« Previous - Version 2/3 (diff) - Next » - Current version
Marcus Pearce, 2013-07-15 03:31 PM


Resampling

These are some low-level functions in the resampling package, which are called by the idyom:idyom function. You shouldn't need to use them unless you are developing the code.

resampling:idyom-resample

idyom:idyom uses resampling:idyom-resample to compute the note-by-note IC values, and can be used to obtain these a list. The function takes a subset of the top-level arguments (see above):
  • Required: dataset-id, target-viewpoints, source-viewpoints (no viewpoint selection)
  • Model: models, ltmo, stmo
  • Training: pretraining-ids, k, resampling-indices

resampling:output-information-content

Takes the output of resampling:idyom-resample and returns the average information content. It takes the following arguments:

  • predictions: the output of resampling:idyom-resample
  • detail: an integer which determines how the information content is averaged (these are returned as multiple values):
    • 1: averaged over the entire dataset
    • 2: and also averaged over each composition
    • 3: and also for each event in each composition

resampling:format-information-content

resampling:format-information-content takes the output of resampling:idyom-resample and writes it to file. It takes the following arguments:
  • predictions: the output of resampling:idyom-resample
  • file: a string denoting a file
  • dataset-id: an integer reflecting the dataset-id
  • detail: an integer which determines how the information content is averaged (these are returned as multiple values):
    • 1: averaged over the entire dataset
    • 2: and also averaged over each composition
    • 3: and also for each event in each composition

Viewpoint Selection

The top-level idyom:idyom function supports viewpoint selection (see above), i.e. searching a space of viewpoints. This uses two functions: run-hill-climber and run-best-first, which take 4 arguments:

  • a list of viewpoints: the algorithm searches through the space of combinations of these viewpoints
  • a start state (usually nil, the empty viewpoint system)
  • an evaluation function returning a numeric performance metric: e.g., the mean information content of the dataset returned by dataset-prediction
  • a symbol describing which way to optimise the metric: :desc mean lower values are better :asc mean greater values are better

Here is an example:

CL-USER> (viewpoint-selection:run-hill-climber 
          '(:cpitch :cpintfref :cpint :contour)
          nil
          #'(lambda (viewpoints)
              (utils:round-to-nearest-decimal-place 
               (resampling:output-information-content 
                (resampling:dataset-prediction 0 '(cpitch) viewpoints :k 10 :models :both+) 
                1)
               2))
          :desc)

 =============================================================================
   System                                                Score
 -----------------------------------------------------------------------------
   NIL                                                   NIL
   (CPITCH)                                              2.52
   (CPINT CPITCH)                                        2.43
   (CPINTFREF CPINT CPITCH)                              2.38
 =============================================================================
#S(VIEWPOINT-SELECTION::RECORD :STATE (:CPINTFREF :CPINT :CPITCH) :WEIGHT 2.38)

Since this can be quite a time consuming process, there are also functions for caching the results.

(initialise-vs-cache)
(load-vs-cache filename package)
(store-vs-cache filename package)