Resampling » History » Version 3
Marcus Pearce, 2013-07-15 03:31 PM
1 | 3 | Marcus Pearce | h1. Low-level functions in Resampling and Viewpoint selection |
---|---|---|---|
2 | 1 | Marcus Pearce | |
3 | 1 | Marcus Pearce | These are some low-level functions in the <code>resampling</code> package, which are called by the <code>idyom:idyom</code> function. You shouldn't need to use them unless you are developing the code. |
4 | 1 | Marcus Pearce | |
5 | 1 | Marcus Pearce | h2. <code>resampling:idyom-resample</code> |
6 | 1 | Marcus Pearce | |
7 | 1 | Marcus Pearce | <code>idyom:idyom</code> uses <code>resampling:idyom-resample</code> 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): |
8 | 1 | Marcus Pearce | |
9 | 1 | Marcus Pearce | * Required: dataset-id, target-viewpoints, source-viewpoints (no viewpoint selection) |
10 | 1 | Marcus Pearce | * Model: models, ltmo, stmo |
11 | 1 | Marcus Pearce | * Training: pretraining-ids, k, resampling-indices |
12 | 1 | Marcus Pearce | |
13 | 1 | Marcus Pearce | h2. <code>resampling:output-information-content</code> |
14 | 1 | Marcus Pearce | |
15 | 1 | Marcus Pearce | Takes the output of <code>resampling:idyom-resample</code> and returns the average information content. It takes the following arguments: |
16 | 1 | Marcus Pearce | |
17 | 1 | Marcus Pearce | * predictions: the output of <code>resampling:idyom-resample</code> |
18 | 1 | Marcus Pearce | * detail: an integer which determines how the information content is averaged (these are returned as multiple values): |
19 | 1 | Marcus Pearce | ** 1: averaged over the entire dataset |
20 | 1 | Marcus Pearce | ** 2: and also averaged over each composition |
21 | 1 | Marcus Pearce | ** 3: and also for each event in each composition |
22 | 1 | Marcus Pearce | |
23 | 1 | Marcus Pearce | h2. <code>resampling:format-information-content</code> |
24 | 1 | Marcus Pearce | |
25 | 1 | Marcus Pearce | <code>resampling:format-information-content</code> takes the output of <code>resampling:idyom-resample</code> and writes it to file. It takes the following arguments: |
26 | 1 | Marcus Pearce | |
27 | 1 | Marcus Pearce | * predictions: the output of <code>resampling:idyom-resample</code> |
28 | 1 | Marcus Pearce | * file: a string denoting a file |
29 | 1 | Marcus Pearce | * dataset-id: an integer reflecting the dataset-id |
30 | 1 | Marcus Pearce | * detail: an integer which determines how the information content is averaged (these are returned as multiple values): |
31 | 1 | Marcus Pearce | ** 1: averaged over the entire dataset |
32 | 1 | Marcus Pearce | ** 2: and also averaged over each composition |
33 | 1 | Marcus Pearce | ** 3: and also for each event in each composition |
34 | 2 | Marcus Pearce | |
35 | 2 | Marcus Pearce | h2. Viewpoint Selection |
36 | 2 | Marcus Pearce | |
37 | 2 | Marcus Pearce | The top-level <code>idyom:idyom</code> function supports viewpoint selection (see above), i.e. searching a space of viewpoints. This uses two functions: <code>run-hill-climber</code> and <code>run-best-first</code>, which take 4 arguments: |
38 | 2 | Marcus Pearce | |
39 | 2 | Marcus Pearce | * a list of viewpoints: the algorithm searches through the space of combinations of these viewpoints |
40 | 2 | Marcus Pearce | * a start state (usually nil, the empty viewpoint system) |
41 | 2 | Marcus Pearce | * an evaluation function returning a numeric performance metric: e.g., the mean information content of the dataset returned by <code>dataset-prediction</code> |
42 | 2 | Marcus Pearce | * a symbol describing which way to optimise the metric: <code>:desc</code> mean lower values are better <code>:asc</code> mean greater values are better |
43 | 2 | Marcus Pearce | |
44 | 2 | Marcus Pearce | Here is an example: |
45 | 2 | Marcus Pearce | |
46 | 2 | Marcus Pearce | <pre> |
47 | 2 | Marcus Pearce | CL-USER> (viewpoint-selection:run-hill-climber |
48 | 2 | Marcus Pearce | '(:cpitch :cpintfref :cpint :contour) |
49 | 2 | Marcus Pearce | nil |
50 | 2 | Marcus Pearce | #'(lambda (viewpoints) |
51 | 2 | Marcus Pearce | (utils:round-to-nearest-decimal-place |
52 | 2 | Marcus Pearce | (resampling:output-information-content |
53 | 2 | Marcus Pearce | (resampling:dataset-prediction 0 '(cpitch) viewpoints :k 10 :models :both+) |
54 | 2 | Marcus Pearce | 1) |
55 | 2 | Marcus Pearce | 2)) |
56 | 2 | Marcus Pearce | :desc) |
57 | 2 | Marcus Pearce | |
58 | 2 | Marcus Pearce | ============================================================================= |
59 | 2 | Marcus Pearce | System Score |
60 | 2 | Marcus Pearce | ----------------------------------------------------------------------------- |
61 | 2 | Marcus Pearce | NIL NIL |
62 | 2 | Marcus Pearce | (CPITCH) 2.52 |
63 | 2 | Marcus Pearce | (CPINT CPITCH) 2.43 |
64 | 2 | Marcus Pearce | (CPINTFREF CPINT CPITCH) 2.38 |
65 | 2 | Marcus Pearce | ============================================================================= |
66 | 2 | Marcus Pearce | #S(VIEWPOINT-SELECTION::RECORD :STATE (:CPINTFREF :CPINT :CPITCH) :WEIGHT 2.38) |
67 | 2 | Marcus Pearce | </pre> |
68 | 2 | Marcus Pearce | |
69 | 2 | Marcus Pearce | Since this can be quite a time consuming process, there are also functions for caching the results. |
70 | 2 | Marcus Pearce | |
71 | 2 | Marcus Pearce | <pre> |
72 | 2 | Marcus Pearce | (initialise-vs-cache) |
73 | 2 | Marcus Pearce | (load-vs-cache filename package) |
74 | 2 | Marcus Pearce | (store-vs-cache filename package) |
75 | 2 | Marcus Pearce | </pre> |