wolffd@0
|
1 % ---
|
wolffd@0
|
2 % this script trains similarity measures using RBM and SVM as in Table 3
|
wolffd@0
|
3 % please note that the RBM training is a probabilistic process.
|
wolffd@0
|
4 % Here, training is done on 20 random initialisations of RBM features ,
|
wolffd@0
|
5 % the test results corresponding to the RBM with the best training result are then
|
wolffd@0
|
6 % returned.
|
wolffd@0
|
7 % ---
|
wolffd@0
|
8
|
wolffd@0
|
9 % ---
|
wolffd@0
|
10 % vary feature parameters of mixed features
|
wolffd@0
|
11 % ---
|
wolffd@0
|
12
|
wolffd@0
|
13 global globalvars;
|
wolffd@0
|
14 globalvars.debug = 3;
|
wolffd@0
|
15
|
wolffd@0
|
16 ftype = 'MTTMixedFeatureSonRBM'; %'MTTMixedFeatureStober11Genre';
|
wolffd@0
|
17
|
wolffd@0
|
18 fparams_all = struct(...
|
wolffd@0
|
19 ... % ---
|
wolffd@0
|
20 ... % these are SONfeatRaw parameters
|
wolffd@0
|
21 ... % ---
|
wolffd@0
|
22 'son_filename',{{'rel_music_raw_features+simdata_ISMIR12.mat'}}, ...
|
wolffd@0
|
23 'son_conf', 1:5, ...
|
wolffd@0
|
24 ... % ---
|
wolffd@0
|
25 ... % Following: RBM params
|
wolffd@0
|
26 ... % ---
|
wolffd@0
|
27 'norm_pre_rbm', 0, ... % norm before RBM?
|
wolffd@0
|
28 'norm_post_rbm',0, ... % norm before RBM?
|
wolffd@0
|
29 'rbm_hidNum',[1000], ... % number of hidden units % 500
|
wolffd@0
|
30 'rbm_eNum', 100, ...
|
wolffd@0
|
31 'rbm_bNum', 1, ...
|
wolffd@0
|
32 'rbm_gNum', 1, ...
|
wolffd@0
|
33 'rbm_lrate1' , [0.05], ... % initial learning rate % 0.01
|
wolffd@0
|
34 'rbm_lrate2', [0.10], ... % learning rate, %0.05
|
wolffd@0
|
35 'rbm_momentum', [0.1], ... % 0.5
|
wolffd@0
|
36 'rbm_cost', [0.00002], ... % cost function
|
wolffd@0
|
37 'rbm_N', 50, ...
|
wolffd@0
|
38 'rbm_MAX_INC', 10 ...
|
wolffd@0
|
39 );
|
wolffd@0
|
40
|
wolffd@0
|
41 % ---
|
wolffd@0
|
42 % vary parameters for svmlight
|
wolffd@0
|
43 % ---
|
wolffd@0
|
44
|
wolffd@0
|
45 trainparams_all = struct(...
|
wolffd@0
|
46 'C', [1], ...%
|
wolffd@0
|
47 'weighted', [0], ...
|
wolffd@0
|
48 'dataset', {{'comp_partBinData_ISMIR12_01.mat'}}, ...
|
wolffd@0
|
49 'inctrain', 0 ...
|
wolffd@0
|
50 ... % this optional
|
wolffd@0
|
51 ... %'deltafun', {{'conv_subspace_delta'}}, ...
|
wolffd@0
|
52 ... %'deltafun_params', {{{[1],[0]},{[5],[1]},{[10],[1]},{[20],[1]},{[30],[1]},{[50],[1]},{[70],[1]}}} ... % normalisation improves results
|
wolffd@0
|
53 );
|
wolffd@0
|
54
|
wolffd@0
|
55 % set training function
|
wolffd@0
|
56 trainfun = @svmlight_wrapper;
|
wolffd@0
|
57
|
wolffd@0
|
58
|
wolffd@0
|
59 % create test directory
|
wolffd@0
|
60 akt_dir = migrate_to_test_dir();
|
wolffd@0
|
61
|
wolffd@0
|
62
|
wolffd@0
|
63 % call eval
|
wolffd@0
|
64 out = test_generic_features_parameters_crossval...
|
wolffd@0
|
65 (fparams_all, trainparams_all, trainfun, ftype);
|
wolffd@0
|
66
|
wolffd@0
|
67 % ---
|
wolffd@0
|
68 % check training results and select best RBM according to trainign data
|
wolffd@0
|
69 % ---
|
wolffd@0
|
70 svm_train_performances = [out(:).mean_ok_train];
|
wolffd@0
|
71 [bestTrain, idx] = max(svm_train_performances(1,:));
|
wolffd@0
|
72 result = out(idx);
|
wolffd@0
|
73
|
wolffd@0
|
74 % get corresponding test performance
|
wolffd@0
|
75 svm_test_performance = result.mean_ok_test(1,:);
|
wolffd@0
|
76 fprintf('SVM RBM Test/Train Result=%f / %f\n',svm_test_performance*100,bestTrain*100);
|