loo_b.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- function rate = loo(waveData, distmat, mode)
- % LOO Leave-one-out test
- if nargin<1, mode=1; end
- waveNum = length(waveData);
- h = waitbar(0, 'Please wait...');
- for i = 1:waveNum,
- % fprintf('i = %gn', i);
- correct(i)= rundtwfcn1(waveData, i, mode, distmat);
- waitbar(i/waveNum, h);
- end;
- close(h)
- rate = sum(correct)/waveNum;
- %=================sub function 1========================
- function correct = rundtwfcn1(waveData, index, mode, distmat)
- waveNum = length(waveData);
- distance = distmat(index, :);
- if mode == 1, % Mode 1 is file-based LOO test
- distance(index) = inf;
- else % Mode 2 is speaker-based LOO test
- for i=1:waveNum,
- if strcmp(waveData(index).speaker, waveData(i).speaker),
- distance(i) = inf;
- end
- end
- end
- [a,b] = sort(distance);
- correct = strcmp(waveData(b(1)).answer, waveData(index).answer);