7

olivetti face dataset kod numarasının matlab code numaralarına uyarlanmış bir sürümünü kullanarak Reducing the dimensionality of data with neural networks bildirilen sonuçları yeniden oluşturmaya çalışıyorum, ancak bazı zorluklarım var. Görünüşe göre, yığınların sayısı, hızları veya momentum sayısı ne kadar fazla olursa olsun, yığılmış RBM'ler büyük bir hatayla ince ayar aşamasına giriyorlar ve sonuç olarak ince ayar aşamasında çok fazla gelişme sağlayamıyorlar. Başka bir gerçek değerli veri kümesinde de benzer bir sorun yaşıyorum.Gerçek değerli giriş derin inanç ağları ile ilgili sorunlar (RBM'lerin)

I (yazıda açıklandığı gibi) daha küçük bir öğrenme oranına sahip bir RBM kullanıyorum ilk katman için

ve

negdata = poshidstates*vishid' + repmat(visbiases,numcases,1); 

ile ben supporting material ama I'de bulunan talimatları takip ediyorum oldukça eminim Doğru hataları alamıyor.

Eksik olduğum bir şey var mı? Aşağıda gerçek değerli görünür birim RBM'ler için kullandığım kodu ve tüm derin eğitim için bakın. Kodun geri kalanı here bulunabilir.

rbmvislinear.m:

epsilonw  = 0.001; % Learning rate for weights 
epsilonvb  = 0.001; % Learning rate for biases of visible units 
epsilonhb  = 0.001; % Learning rate for biases of hidden units 
weightcost = 0.0002; 
initialmomentum = 0.5; 
finalmomentum = 0.9; 


[numcases numdims numbatches]=size(batchdata); 

if restart ==1, 
    restart=0; 
    epoch=1; 

% Initializing symmetric weights and biases. 
    vishid  = 0.1*randn(numdims, numhid); 
    hidbiases = zeros(1,numhid); 
    visbiases = zeros(1,numdims); 


    poshidprobs = zeros(numcases,numhid); 
    neghidprobs = zeros(numcases,numhid); 
    posprods = zeros(numdims,numhid); 
    negprods = zeros(numdims,numhid); 
    vishidinc = zeros(numdims,numhid); 
    hidbiasinc = zeros(1,numhid); 
    visbiasinc = zeros(1,numdims); 
    sigmainc = zeros(1,numhid); 
    batchposhidprobs=zeros(numcases,numhid,numbatches); 
end 

for epoch = epoch:maxepoch, 
fprintf(1,'epoch %d\r',epoch); 
errsum=0; 
for batch = 1:numbatches, 
if (mod(batch,100)==0) 
    fprintf(1,' %d ',batch); 
end 


%%%%%%%%% START POSITIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    data = batchdata(:,:,batch); 
    poshidprobs = 1./(1 + exp(-data*vishid - repmat(hidbiases,numcases,1))); 
    batchposhidprobs(:,:,batch)=poshidprobs; 
    posprods = data' * poshidprobs; 
    poshidact = sum(poshidprobs); 
    posvisact = sum(data); 

%%%%%%%%% END OF POSITIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    poshidstates = poshidprobs > rand(numcases,numhid); 

%%%%%%%%% START NEGATIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    negdata = poshidstates*vishid' + repmat(visbiases,numcases,1);% + randn(numcases,numdims) if not using mean 
    neghidprobs = 1./(1 + exp(-negdata*vishid - repmat(hidbiases,numcases,1))); 
    negprods = negdata'*neghidprobs; 
    neghidact = sum(neghidprobs); 
    negvisact = sum(negdata); 

%%%%%%%%% END OF NEGATIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    err= sum(sum((data-negdata).^2)); 
    errsum = err + errsum; 

    if epoch>5, 
    momentum=finalmomentum; 
    else 
    momentum=initialmomentum; 
    end; 

%%%%%%%%% UPDATE WEIGHTS AND BIASES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    vishidinc = momentum*vishidinc + ... 
       epsilonw*((posprods-negprods)/numcases - weightcost*vishid); 
    visbiasinc = momentum*visbiasinc + (epsilonvb/numcases)*(posvisact-negvisact); 
    hidbiasinc = momentum*hidbiasinc + (epsilonhb/numcases)*(poshidact-neghidact); 

    vishid = vishid + vishidinc; 
    visbiases = visbiases + visbiasinc; 
    hidbiases = hidbiases + hidbiasinc; 

%%%%%%%%%%%%%%%% END OF UPDATES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

end 
fprintf(1, '\nepoch %4i error %f \n', epoch, errsum); 

end 

dofacedeepauto.m: Zaman ayırdığınız için

clear all 
close all 

maxepoch=200; %In the Science paper we use maxepoch=50, but it works just fine. 
numhid=2000; numpen=1000; numpen2=500; numopen=30; 

fprintf(1,'Pretraining a deep autoencoder. \n'); 
fprintf(1,'The Science paper used 50 epochs. This uses %3i \n', maxepoch); 

load fdata 
%makeFaceData; 

[numcases numdims numbatches]=size(batchdata); 

fprintf(1,'Pretraining Layer 1 with RBM: %d-%d \n',numdims,numhid); 
restart=1; 
rbmvislinear; 
hidrecbiases=hidbiases; 
save mnistvh vishid hidrecbiases visbiases; 

maxepoch=50; 
fprintf(1,'\nPretraining Layer 2 with RBM: %d-%d \n',numhid,numpen); 
batchdata=batchposhidprobs; 
numhid=numpen; 
restart=1; 
rbm; 
hidpen=vishid; penrecbiases=hidbiases; hidgenbiases=visbiases; 
save mnisthp hidpen penrecbiases hidgenbiases; 

fprintf(1,'\nPretraining Layer 3 with RBM: %d-%d \n',numpen,numpen2); 
batchdata=batchposhidprobs; 
numhid=numpen2; 
restart=1; 
rbm; 
hidpen2=vishid; penrecbiases2=hidbiases; hidgenbiases2=visbiases; 
save mnisthp2 hidpen2 penrecbiases2 hidgenbiases2; 

fprintf(1,'\nPretraining Layer 4 with RBM: %d-%d \n',numpen2,numopen); 
batchdata=batchposhidprobs; 
numhid=numopen; 
restart=1; 
rbmhidlinear; 
hidtop=vishid; toprecbiases=hidbiases; topgenbiases=visbiases; 
save mnistpo hidtop toprecbiases topgenbiases; 

backpropface; 

Teşekkür

cevap

2

aptalım, ben ince ayar komut arka yayılmasını değiştirmek unutmuştu (backprop.m). Biri, gerçek yüzdeli birimler için çıktı katmanını (yüzlerin yeniden yapılandırıldığı) değiştirmelidir. Yani

dataout = w7probs*w8; 
+0

Bunu biraz açıklayabilir misiniz? Gerçek değerli görünür birimlere ve ikili gizli birimlere sahipseniz, ikili bir çıktınız olmayacak mı? Veya son katmanı bir BG katmanı olarak değiştiriyor musunuz? –