Mercurial > hg > map
comparison userProgramsASRforDummies/Exp_Tutorial_1.m @ 38:c2204b18f4a2 tip
End nov big change
| author | Ray Meddis <rmeddis@essex.ac.uk> |
|---|---|
| date | Mon, 28 Nov 2011 13:34:28 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 37:771a643d5c29 | 38:c2204b18f4a2 |
|---|---|
| 1 function Exp_Tutorial_1(isMasterNode) | |
| 2 | |
| 3 % Some description of the experiment goes here | |
| 4 | |
| 5 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 6 % Set up the basic folders | |
| 7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 8 expName = 'Tutorial'; | |
| 9 dataFolderPrefix = 'featR'; | |
| 10 if isunix | |
| 11 expFolderPrefix = '/scratch/nrclark/exps/'; | |
| 12 else | |
| 13 expFolderPrefix = 'D:\Exps'; | |
| 14 end | |
| 15 | |
| 16 expFolder = fullfile(expFolderPrefix,expName); | |
| 17 hmmFolder = fullfile(expFolder,'hmm'); | |
| 18 | |
| 19 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 20 % Sort out the training (LEARNING) condition | |
| 21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 22 learnFolder = fullfile(expFolder,'featL'); | |
| 23 | |
| 24 xL = cJob('L', learnFolder); | |
| 25 | |
| 26 xL.participant = 'Normal'; | |
| 27 xL.MAPparamChanges= {'DRNLParams.rateToAttenuationFactorProb=0;', 'OMEParams.rateToAttenuationFactorProb=0;' }; | |
| 28 | |
| 29 xL.noiseLevToUse = -200; | |
| 30 xL.speechLevToUse = 60; | |
| 31 | |
| 32 xL.MAPopHSR = 1; | |
| 33 xL.MAPopMSR = 0; | |
| 34 xL.MAPopLSR = 0; | |
| 35 | |
| 36 | |
| 37 xL.numCoeff = 14; | |
| 38 xL.removeEnergyStatic = 0; | |
| 39 | |
| 40 %%%%% Group of params that will influence simulation run time %%%%%%% | |
| 41 xL.numWavs = 12; %MAX=8440 | |
| 42 testWavs = 6; %MAX = 358 | |
| 43 nzLevel = [-200 40:10:70]; | |
| 44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 45 | |
| 46 xL.noisePreDur = 1; | |
| 47 xL.noisePostDur = 0.1; | |
| 48 xL.truncateDur = xL.noisePreDur-0.1; | |
| 49 | |
| 50 xL.noiseName = 'pink_demo'; | |
| 51 | |
| 52 if isMasterNode && ~isdir(xL.opFolder) | |
| 53 mkdir(xL.opFolder); | |
| 54 xL = xL.assignFiles; | |
| 55 xL.storeSelf; % This is a call to a member function and is not a pointless line of code! | |
| 56 end | |
| 57 | |
| 58 | |
| 59 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 60 % Sort out the testing (RECOGNITION) conditions | |
| 61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 62 recConditions = numel(nzLevel); | |
| 63 | |
| 64 tmpIdx=0; | |
| 65 for nn = 0*recConditions+1:1*recConditions | |
| 66 tmpIdx=tmpIdx+1; | |
| 67 xR{nn} = xL; %simply copy the "Learn" object and change it a bit below | |
| 68 recFolder = fullfile(expFolder,[dataFolderPrefix num2str(nn)]); | |
| 69 xR{nn}.opFolder = recFolder; | |
| 70 | |
| 71 %These are the interesting differences between training and testing | |
| 72 xR{nn}.numWavs = testWavs; %MAX = 358 | |
| 73 xR{nn}.noiseLevToUse = nzLevel(tmpIdx); | |
| 74 xR{nn}.MAPparamChanges= {'DRNLParams.rateToAttenuationFactorProb=0;'}; | |
| 75 | |
| 76 %Now just to wrap it up ready for processing | |
| 77 if isMasterNode && ~isdir(xR{nn}.opFolder) | |
| 78 mkdir(xR{nn}.opFolder); | |
| 79 xR{nn} = xR{nn}.assignWavPaths('R'); | |
| 80 xR{nn} = xR{nn}.assignFiles; | |
| 81 xR{nn}.storeSelf; | |
| 82 end | |
| 83 end | |
| 84 | |
| 85 tmpIdx=0; | |
| 86 for nn = 1*recConditions+1:2*recConditions | |
| 87 tmpIdx=tmpIdx+1; | |
| 88 xR{nn} = xL; %simply copy the "Learn" object and change it a bit below | |
| 89 recFolder = fullfile(expFolder,[dataFolderPrefix num2str(nn)]); | |
| 90 xR{nn}.opFolder = recFolder; | |
| 91 | |
| 92 %These are the interesting differences between training and testing | |
| 93 xR{nn}.numWavs = testWavs; %MAX = 358 | |
| 94 xR{nn}.noiseLevToUse = nzLevel(tmpIdx); | |
| 95 xR{nn}.MAPparamChanges= {'DRNLParams.rateToAttenuationFactorProb=-10^(-10/20);'}; | |
| 96 | |
| 97 | |
| 98 %Now just to wrap it up ready for processing | |
| 99 if isMasterNode && ~isdir(xR{nn}.opFolder) | |
| 100 mkdir(xR{nn}.opFolder); | |
| 101 xR{nn} = xR{nn}.assignWavPaths('R'); | |
| 102 xR{nn} = xR{nn}.assignFiles; | |
| 103 xR{nn}.storeSelf; | |
| 104 end | |
| 105 end | |
| 106 | |
| 107 | |
| 108 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 109 % ** Generate features ** | |
| 110 % This is the time consuming, processing intensive portion of the program. | |
| 111 % Nodes that are not the master node are only interested in the opFolder | |
| 112 % member of the jobjects. | |
| 113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 114 worker(xL.opFolder); | |
| 115 maxConds = nn; | |
| 116 if ~isMasterNode %dont bother wasting master node effort on generating testing features (for now) | |
| 117 for nn = 1:maxConds | |
| 118 worker(xR{nn}.opFolder); | |
| 119 end | |
| 120 end | |
| 121 | |
| 122 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 123 % Train and test the recogniser - a job for the master node only | |
| 124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 125 if isMasterNode | |
| 126 while(~all(xL.todoStatus==2)) | |
| 127 disp('Waiting on straggler nodes to complete their jobs before HMM is trained . . .') | |
| 128 pause(30); %Wait for 30 seconds before looking again | |
| 129 xL.lockJobList; | |
| 130 xL = xL.loadSelf; %Reload incase changed | |
| 131 xL.unlockJobList; | |
| 132 end | |
| 133 y = cHMM(hmmFolder); | |
| 134 y.numCoeff = (xL.numCoeff-logical(xL.removeEnergyStatic)) * 3; | |
| 135 y.createSCP(xL.opFolder) | |
| 136 y.createMLF(xL.opFolder) | |
| 137 y.train(xL.opFolder) %This node can be busy training, even if other jobs are being processed for testing | |
| 138 | |
| 139 % ALLOW MASTER NODE TO MUCK IN WITH GENERATING TESTING FEATURES ONCE | |
| 140 % HMM HAS BEEN TRAINED | |
| 141 for nn = 1:maxConds | |
| 142 worker(xR{nn}.opFolder); | |
| 143 end | |
| 144 | |
| 145 xR{end}.lockJobList; | |
| 146 xR{end} = xR{end}.loadSelf; %Reload changes | |
| 147 xR{end}.unlockJobList; | |
| 148 while(~all(xR{end}.todoStatus==2)) | |
| 149 disp('Waiting on straggler nodes to complete their jobs before HMM is tested . . .') | |
| 150 pause(30); %Wait for 30 seconds before looking again | |
| 151 xR{end}.lockJobList; | |
| 152 xR{end} = xR{end}.loadSelf; %Reload incase changed | |
| 153 xR{end}.unlockJobList; | |
| 154 end | |
| 155 | |
| 156 for nn = 1:maxConds | |
| 157 y.createSCP(xR{nn}.opFolder); | |
| 158 y.test(xR{nn}.opFolder); | |
| 159 end | |
| 160 | |
| 161 %Show all of the scores in the command window at the end | |
| 162 for nn = 1:maxConds | |
| 163 y.score(xR{nn}.opFolder); | |
| 164 end | |
| 165 end |
