資源簡介
DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容

代碼片段和文件信息
%?Version?1.000
%
%?Code?provided?by?Ruslan?Salakhutdinov?and?Geoff?Hinton
%
%?Permission?is?granted?for?anyone?to?copy?use?modify?or?distribute?this
%?program?and?accompanying?programs?and?documents?for?any?purpose?provided
%?this?copyright?notice?is?retained?and?prominently?displayed?along?with
%?a?note?saying?that?the?original?programs?are?available?from?our
%?web?page.
%?The?programs?and?documents?are?distributed?without?any?warranty?express?or
%?implied.??As?the?programs?were?written?for?research?purposes?only?they?have
%?not?been?tested?to?the?degree?that?would?be?advisable?in?any?important
%?application.??All?use?of?these?programs?is?entirely?at?the?user‘s?own?risk.
%?This?program?fine-tunes?an?autoencoder?with?backpropagation.
%?Weights?of?the?autoencoder?are?going?to?be?saved?in?mnist_weights.mat
%?and?trainig?and?test?reconstruction?errors?in?mnist_error.mat
%?You?can?also?set?maxepoch?default?value?is?200?as?in?our?paper.??
maxepoch=200;
fprintf(1‘\nTraining?discriminative?model?on?MNIST?by?minimizing?cross?entropy?error.?\n‘);
fprintf(1‘60?batches?of?1000?cases?each.?\n‘);
load?mnistvhclassify
load?mnisthpclassify
load?mnisthp2classify
makebatches;
[numcases?numdims?numbatches]=size(batchdata);
N=numcases;?
%%%%?PREINITIALIZE?WEIGHTS?OF?THE?DISCRIMINATIVE?MODEL%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w1=[vishid;?hidrecbiases];
w2=[hidpen;?penrecbiases];
w3=[hidpen2;?penrecbiases2];
w_class?=?0.1*randn(size(w32)+110);
?
%%%%%%%%%%?END?OF?PREINITIALIZATIO?OF?WEIGHTS??%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
l1=size(w11)-1;
l2=size(w21)-1;
l3=size(w31)-1;
l4=size(w_class1)-1;
l5=10;?
test_err=[];
train_err=[];
for?epoch?=?1:maxepoch
%%%%%%%%%%%%%%%%%%%%?COMPUTE?TRAINING?MISCLASSIFICATION?ERROR?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
err=0;?
err_cr=0;
counter=0;
[numcases?numdims?numbatches]=size(batchdata);
N=numcases;
?for?batch?=?1:numbatches
??data?=?[batchdata(::batch)];
??target?=?[batchtargets(::batch)];
??data?=?[data?ones(N1)];
??w1probs?=?1./(1?+?exp(-data*w1));?w1probs?=?[w1probs??ones(N1)];
??w2probs?=?1./(1?+?exp(-w1probs*w2));?w2probs?=?[w2probs?ones(N1)];
??w3probs?=?1./(1?+?exp(-w2probs*w3));?w3probs?=?[w3probs??ones(N1)];
??targetout?=?exp(w3probs*w_class);%?
??targetout?=?targetout./repmat(sum(targetout2)110);%?
??[I?J]=max(targetout[]2);
??[I1?J1]=max(target[]2);
??counter=counter+length(find(J==J1));
??err_cr?=?err_cr-?sum(sum(?target(:1:end).*log(targetout)))?;%?
?end
?train_err(epoch)=(numcases*numbatches-counter);
?train_crerr(epoch)=err_cr/numbatches;
%%%%%%%%%%%%%%?END?OF?COMPUTING?TRAINING?MISCLASSIFICATION?ERROR?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%?COMPUTE?TEST?MISCLASSIFICATION?ERROR?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
err=0;
err_cr=0;
counter=0;
[testnumcases?testnumdims?testnumbatches]=size(testbatchdata);
N=testnumcases;
for?batch?=?1:testnumbatches
??data?=?[testbatchdata(::batch)];
??target?=?[testbatchtargets(::batch)];
??data?=?[data?ones(N1)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-09-21?11:25??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\
?????文件????????5483??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\backpropclassify.m
?????文件?????????904??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\bp.asv
?????文件?????????935??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\bp.m
?????文件????????2001??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\dbnFit.m
?????文件?????????495??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\dbnPredict.m
?????文件????????1799??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\examplecode.m
?????文件?????????409??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\interweave.m
?????文件??????????65??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\logistic.m
?????文件?????????977??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\nunique.m
?????文件?????????690??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\prepareArgs.m
?????文件????????3819??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\process_options.m
?????文件????????5293??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\rbmBB.m
?????文件????????6149??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\rbmFit.m
?????文件????????3806??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\rbmGB.m
?????文件?????????358??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\rbmHtoV.m
?????文件?????????877??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\rbmPredict.m
?????文件?????????355??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\rbmVtoH.m
?????文件?????????286??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\softmaxPmtk.m
?????文件?????????371??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\softmax_sample.m
?????文件?????????976??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\train.asv
?????文件?????????913??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\train.m
?????文件?????3205929??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\traindata.mat
?????文件?????????750??2014-09-21?11:22??DBN源碼,深度學習領域的適合初學者學習的代碼之一,基礎必備的內容\visualize.m
- 上一篇:軟件構件與中間件技術
- 下一篇:地形渲染的動態LOD四叉樹算法
評論
共有 條評論