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. 用Fiddle跟踪调试移动表单

    简介:Fiddle,调试,移动表单 http://jingyan.baidu.com/article/925f8cb81e3a52c0dde05616.html

  2. 从“窃听门”事件解读手机Rootkit攻击

    从"窃听门"事件解读手机Rootkit攻击 在今年五月讲述了手机流氓软件危害与防治(http://chenguang.blog.51cto.com/350944/557191)文章 ...

  3. position(static-relative-absolute-fixed),margin(top-right-bottom-left),top-right-bottom-left

    最近写css遇到一些问题,所以准备写下来捋一下思路. 1.position=satic下看margin的使用.(top-right-bottom-left在这种case下无效) 1-1)margin ...

  4. 移动mm 话费支付接入过程(ane)

    下面记录移动mm 话费支付接入的过程 1.强联网.弱联网差别.sdk是否有区分?用户体验部分由什么不同和差异? 差别在于强联网是网络通道(wifi/gprs/3g),弱联网是走短信通道,用户层面差异在 ...

  5. 3. Spring Boot Servlet

    转自:https://blog.csdn.net/catoop/article/details/50501686

  6. GO语言学习(十二)Go 语言函数

    Go 语言函数 函数是基本的代码块,用于执行一个任务. Go 语言最少有个 main() 函数. 你可以通过函数来划分不同功能,逻辑上每个函数执行的是指定的任务. 函数声明告诉了编译器函数的名称,返回 ...

  7. [RxJS] How To get the results of two HTTP requests made in sequence

    switchMap can chain two HTTP requests together, creating one request based on the results of the fir ...

  8. StringBuilder和String的区别

      使用   StringBuilder 语言 C# String   对象是不可改变的.每次使用   System.String   类中的方法之一时,都要在内存中创建一个新的字符串对象,这就需要为 ...

  9. express,中间件(body-parser),req.body获取不到参数(含postman发请求的方法)

    问题描述: 最近在做毕设,express 里边的中间件(body-parser)失效,req.body获取不到任何值,req.query能获取到值.一开始加body-parser中间件是有用的,直到昨 ...

  10. DC针对pipeline的优化

    set_optimize_register    true compile  -ultra 调整pipleline各级的组合逻辑,使得各级组合逻辑的延迟跟接近 对非pipeline进行优化: regi ...