www.pudn.com > dbn.zip > train.asv, change:2012-05-18,size:976b


load traindata 
traindat=traindata(2:2:18000,:); 
for i=1:length(label) 
    if label(i)== 
trainlabel=label(1:2:18000,:); 
testdata=traindata(1:2:18000,:); 
testlabels=label(1:2:18000,:); 
% data=mfcc{1}; 
% len=length(data); 
% labels=ones(len,1); 
op.verbose=true; 
models=dbnFit(traindat,[100 100 100 100 100],trainlabel,op,op,op,op,op); 
yhat2=dbnPredict(models,testdata); 
% up_down(models,data,labels); 
fprintf('Classification error using DBN with 100-100 hiddens is %f\n', ... 
sum(yhat2~=testlabels)/length(yhat2)); 
 
%visualize weights 
% figure(4) 
% subplot(1,2,1) 
% visualize(models{1}.W); 
% title('learned weights on DBN layer 1'); 
% subplot(1,2,2) 
% visualize(models{2}.W); 
% title('learned weights on DBN layer 2'); 
%  
% %visualize the mislabeled cases. Note the transpose. Visualize assumes DxN 
% %as is the case for weights 
% figure(5) 
% visualize(testdata(yhat2~=testlabels,:)'); 
% title('classification mistakes for DBN with 100-100 hiddens');