clear all
close all %% 1:参数设置
maxepoch=10; %In the Science paper we use maxepoch=50, but it works just fine.
numhid=1000; numpen=500; numpen2=250; numopen=30; %% 2:数据准备
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;
% batchdata,第二个维度上的像素值,是 0-1 之间;
[numcases, numdims, numbatches]=size(batchdata);
% [100*784*600],100*600 ==> 60000,也恰是训练样本的数目,也即batchdata存储的全部是训练样本(不包括 targets);
% numcases:行数(batch_size,块内样本的数目),样本数目,numdims:维度数目,列数,
% numbatches:块的数目
%% 3:逐层训练
% 第一层: numdims ⇒ numhid(784 ⇒ 1000)
fprintf(1,'Pretraining Layer 1 with RBM: %d-%d \n',numdims,numhid);
restart=1;
rbm;
hidrecbiases=hidbiases;
save mnistvh vishid hidrecbiases visbiases; % 第二层:numhid ⇒ numen (1000 ==> 500)
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; % 第三层:numen ⇒ numen(500 ⇒ 250)
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; % 第四层:numen2 ⇒ numopen(250 ==> 30)
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; backprop;

深度学习代码注解(一)—— mnistdeepauto的更多相关文章

  1. 如何免费使用GPU跑深度学习代码

    从事深度学习的研究者都知道,深度学习代码需要设计海量的数据,需要很大很大很大(重要的事情说三遍)的计算量,以至于CPU算不过来,需要通过GPU帮忙,但这必不意味着CPU的性能没GPU强,CPU是那种综 ...

  2. Google Colab——用谷歌免费GPU跑你的深度学习代码

    Google Colab简介 Google Colaboratory是谷歌开放的一款研究工具,主要用于机器学习的开发和研究.这款工具现在可以免费使用,但是不是永久免费暂时还不确定.Google Col ...

  3. 【深度学习Deep Learning】资料大全

    最近在学深度学习相关的东西,在网上搜集到了一些不错的资料,现在汇总一下: Free Online Books  by Yoshua Bengio, Ian Goodfellow and Aaron C ...

  4. 深度学习(DNN)的学习网站

    近期决定对深度学习稍微学习一下,因此搜集了一些相关的网站和资料,特分享给大家. 首先,如果你对机器学习还不甚了解,最好先了解一下其相关的概念,推荐 Andrew Ng在斯坦福的机器学习教程 (中文翻译 ...

  5. Cs231n课堂内容记录-Lecture 8 深度学习框架

    Lecture 8  Deep Learning Software 课堂笔记参见:https://blog.csdn.net/u012554092/article/details/78159316 今 ...

  6. 使用colab运行深度学习gpu应用(Mask R-CNN)实践

    1,目的 Google Colaboratory(https://colab.research.google.com)是谷歌开放的一款研究工具,主要用于机器学习的开发和研究.这款工具现在可以免费使用, ...

  7. 完全基于 Java 的开源深度学习平台,亚马逊的大佬带你上手

    本文适合有 Java 基础的人群 作者:DJL-Lanking HelloGitHub 推出的<讲解开源项目>系列.有幸邀请到了亚马逊 + Apache 的工程师:Lanking( htt ...

  8. 深度学习之卷积神经网络(CNN)详解与代码实现(一)

    卷积神经网络(CNN)详解与代码实现 本文系作者原创,转载请注明出处:https://www.cnblogs.com/further-further-further/p/10430073.html 目 ...

  9. 深度学习Trick——用权重约束减轻深层网络过拟合|附(Keras)实现代码

    在深度学习中,批量归一化(batch normalization)以及对损失函数加一些正则项这两类方法,一般可以提升模型的性能.这两类方法基本上都属于权重约束,用于减少深度学习神经网络模型对训练数据的 ...

随机推荐

  1. uiautomator——第一个例子:打开浏览器,输入网址

    1.在sdk安装目录:E:\Test_Tools\auto_test\app\adt-bundle-windows-x86-20131030\sdk\tools下启动uiautomatorviewer ...

  2. POJ 1738 An old Stone Game(石子合并 经典)

    An old Stone Game Time Limit: 5000MS   Memory Limit: 30000K Total Submissions: 3672   Accepted: 1035 ...

  3. C#之菜单控件、主窗体打开子窗体、GroupBox控件使用

    一.背景 一年前有学习过C#,但没有在项目中去实际做APP,重新捡起来应用到项目中.我同事本来做好一个CANOPEN设备管理的界面,由于近期搜索了别人的开发的界面,我觉得有很多东西要重新安排,以及我已 ...

  4. 【例题 8-2 UVA-1605】Building for UN

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 两层 然后n*n就够了 第一层类似 aaa.. bbb.. ccc.. ... 第二次则变成 abc.... abc.... abc ...

  5. [Javascript AST] 3. Continue: Write ESLint rule

    The rule we want to write is show warning if user using console method: // valid foo.console() conso ...

  6. openstack之虚拟机创建流程分析

    这篇博文静静的呆在草稿箱大半年了.假设不是由于某些原因被问到,以及由于忽略它而导致的损失,否则我也不知道什么时候会将它完毕.感谢这段时间经历的挫折,让我知道不足.希望你能给我更大的决心! 本文试图具体 ...

  7. Talk the Talk

     Talk the Talk Mark Richards in Any pRoFESSion, jargon is used so that individuals within that pro- ...

  8. ViewPager+Fragmrnt最简单结合方法

    Fragment和ViewPager 本博文系本菜鸟第一次博文展示,有错误之处请虽然提出 FragmentPagerAdapter 谷歌官方提供了这么一个adapter(FragmentPagerAd ...

  9. javascript中if条件

    1.布尔变量 true/false 2.数字非0.非NaN/0.NaN 3.对象非null/null.nudefined 4.字符串非空串/空串 if(!!str){ //do something } ...

  10. 不同jquery对象触发相同的函数 “.js-story-title,.js-mt-index-cont2”

    $(document).on("click",".js-story-title,.js-mt-index-cont2",function () {}