资源简介
实现深度玻尔兹曼机的手写识别,数据库是标准手写识别数据库,自己可以去下载
代码片段和文件信息
% Version 1.000
%
% Code provided by Ruslan Salakhutdinov
%
% 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.
test_err=[];
test_crerr=[];
train_err=[];
train_crerr=[];
fprintf(1‘\nTraining discriminative model on MNIST by minimizing cross entropy error. \n‘);
fprintf(1‘60 batches of 1000 cases each. \n‘);
[numcases numdims numbatches]=size(batchdata);
N=numcases;
load fullmnist_dbm
[numdims numhids] = size(vishid);
[numhids numpens] = size(hidpen);
%%%%%% Preprocess the data %%%%%%%%%%%%%%%%%%%%%%
[testnumcases testnumdims testnumbatches]=size(testbatchdata);
N=testnumcases;
temp_h2_test = zeros(testnumcasesnumpenstestnumbatches);
for batch = 1:testnumbatches
data = [testbatchdata(::batch)];
[temp_h1 temp_h2] = ...
mf_class(datavishidhidbiasesvisbiaseshidpenpenbiases);
temp_h2_test(::batch) = temp_h2;
end
[numcases numdims numbatches]=size(batchdata);
N=numcases;
temp_h2_train = zeros(numcasesnumpensnumbatches);
for batch = 1:numbatches
data = [batchdata(::batch)];
[temp_h1 temp_h2] = ...
mf_class(datavishidhidbiasesvisbiaseshidpenpenbiases);
temp_h2_train(::batch) = temp_h2;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w1_penhid = hidpen‘;
w1_vishid = vishid;
w2 = hidpen;
h1_biases = hidbiases; h2_biases = penbiases;
w_class = 0.1*randn(numpens10);
topbiases = 0.1*randn(110);
for epoch = 1:maxepoch
%%%% TEST STATS
%%%% Error rates
[testnumcases testnumdims testnumbatches]=size(testbatchdata);
N=testnumcases;
bias_hid= repmat(h1_biasesN1);
bias_pen = repmat(h2_biasesN1);
bias_top = repmat(topbiasesN1);
err=0;
err_cr=0;
counter=0;
for batch = 1:testnumbatches
data = [testbatchdata(::batch)];
temp_h2 = temp_h2_test(::batch);
target = [testbatchtargets(::batch)];
w1probs = 1./(1 + exp(-data*w1_vishid -temp_h2*w1_penhid - bias_hid ));
w2probs = 1./(1 + exp(-w1probs*w2 - bias_pen));
targetout = exp(w2probs*w_class + bias_top );
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
test_err(epoch)=counter;
test_crerr(epoch)=err_cr;
fprintf(1‘\nepoch %d test misclassification err %d (out of 10000) test cross entropy error
- 上一篇:毕业论文外文文献(外文)
- 下一篇:读取动捕数据版本2
相关资源
- PCB识别包含程序截图和原图
- 神经网络和深度学习—吴恩达 第三周
- 无网格方法解悬臂梁问题
- 基于maltab的LED阵列仿真
- 稀疏分解图像重建程序,把图像分解
- 基于ANN的6种2ASK、4ASK、2FSK、4FSK、2P
- 深度学习 脑部图像分割
- 深度学习综述英文
- 数字图像处理大作业————各种图
- IAPWS_IF97
- CBBA任务分配程序
- Tasi和张正友两种方法仿真程序
- labview读取mat格式文件
- mat格式文件在labview中显示波形
- 基于tensorflow的猫狗图片的识别分类
- Turbo码的编解码,可以达到论文中仿真
- JPEG压缩源码(已经经过测试)
- 吴恩达老师深度学习课程作业用到的
- 高斯低通滤波器(GLPF)
- word2vec 中的数学原理详解-电子版.do
- 智能优化算法选址,源代码,有注解
- 自适应各向异性扩散
- 电子科技大学数学实验第二次课上微
- 电机转差控制
- shibie.zip
- 随机共振的Runge-Kutta解法
- BP神经网路的变压器故障检测.zip
- OFDM信号功率谱密度
- 粒子群优化算法工具箱(PSO_toolbox)
- Human-level control through deep reinforcement
评论
共有 条评论