资源简介
hinton论文代码注解
Matlab示例代码为两部分,分别对应不同的论文:
1. Reducing the Dimensionality of data with neural networks
ministdeepauto.m backprop.m rbmhidlinear.m
2. A fast learing algorithm for deep belief net
mnistclassify.m backpropclassfy.m
代码片段和文件信息
Matlab示例代码为两部分,分别对应不同的论文:
1. Reducing the Dimensionality of data with neural networks
ministdeepauto.m backprop.m rbmhidlinear.m
2. A fast learing algorithm for deep belief net
mnistclassify.m backpropclassfy.m
其余部分代码通用。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mnistclassify.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
maxepoch=50; %迭代次数
numhid=500; numpen=500; numpen2=2000;
fprintf(1‘Converting Raw files into Matlab format \n‘);
converter;
fprintf(1‘Pretraining a deep autoencoder. \n‘);
fprintf(1‘The Science paper used 50 epochs. This uses %3i \n‘ maxepoch);
makebatches;%分批数据
[numcases numdims numbatches]=size(batchdata); %获取batchdata数据大小
%%numcases 每批数据的个数
%%numdims 数据元组的维度
%%numbtches 数据批数
fprintf(1‘Pretraining layer 1 with RBM: %d-%d \n‘numdimsnumhid);%图像输入层到第一个隐藏层
restart=1; %设置初始化参数
rbm; %调用RBM训练数据
hidrecbiases=hidbiases; %获取隐藏层偏置值
save mnistvhclassify vishid hidrecbiases visbiases; %
fprintf(1‘\nPretraining layer 2 with RBM: %d-%d \n‘numhidnumpen);%第一个隐藏层到第二个隐藏层
batchdata=batchposhidprobs; %上一个RBM的隐藏层输出,读入作为这个RBM的输入
numhid=numpen;%设置隐藏层的节点数,输入的节点数已经由读入数据给出
restart=1;
rbm;
hidpen=vishid; penrecbiases=hidbiases; hidgenbiases=visbiases; %同上,提取权值,偏置,
save mnisthpclassify hidpen penrecbiases hidgenbiases;
fprintf(1‘\nPretraining layer 3 with RBM: %d-%d \n‘numpennumpen2);%第二个隐藏层到第三层隐藏层,其余同上
batchdata=batchposhidprobs;
numhid=numpen2;
restart=1;
rbm;
hidpen2=vishid; penrecbiases2=hidbiases; hidgenbiases2=visbiases;
save mnisthp2classify hidpen2 penrecbiases2 hidgenbiases2;
backpropclassify;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
backpropclassify.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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);%随机生成第四层列数+1行,10列的矩阵
%%%%%%%%%% END OF PREINITIALIZATIO OF WEIGHTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
l1=size(w11)-1;%获取每层的单元个数
l2=size(w21)-1;
l3=size(w31)-1;
l4=size(w_class1)-1;%最高层的单元个数
l5=10; %label层单元个数
test_err=[];%
train_err=[];%
for epoch = 1:maxepoch
%%%%%%%%%%%%%%%%%%%% COMPUTE TRAINING MISCLASSIFICATION ERROR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
err=0;
err_cr=0;
counter=0;
[numcases numdims numbatches]=size(batchdata);
%%numcases 每批数据的
- 上一篇:共振峰提取 Matlab程序
- 下一篇:susan算法matlab
相关资源
- 基于神经网络的文本无关的说话人识
- bp神经网络matlab代码82083
- matlab写的人工神经网络BP股价预测模型
- 模糊神经网络matlab源程序
- bp神经网络的车牌识别M文件
- 神经网络与matlab7.0实现书中源代码
- 神经网络matlab代码
- 基于BP神经网络的系统建模辨识与预测
- BP神经网络数据集代码
- 模糊神经网络matlab代码
- RBF神经网络自适应控制MATLAB仿真程序
- matlabs神经网络-基于模糊神经网络的水
- 基于matlab的车牌识别,采用的是BP神经
- BP神经网络的算法matlab代码
- BP神经网络预测matlaB实现
- 改进过的神经网络elm算法.m
- BP神经网络数据预测matlab代码.zip
- 4 BP神经网络信号拟合matlab程序.zip
- 基于Hebb学习规则的单神经元PID控制的
- 一个基于bp神经网络的matlab 识别0-9数
- BP人工神经网络拟合正弦曲线程序完美
- matlab神经网络预测程序-预测.txt
- MatlabSOM神经网络分类程序-SOM神经网络
- Matlab的RBF神经网络用于模式分类-RBF
- RNN-LSTM 卷积神经网络使用 Matlab 实现
- MATLAB神经网络手写数字识别GUI,论文
- MATLAB之BP神经网络的汉字识别GUI,可换
- BP神经网络时间序列预测matlab代码ma
- matlab 遗传算法优化BP神经网络程序
- 基于BP神经网络的MATLAB回归程序
评论
共有 条评论