UFLDL教程:Exercise:Vectorization
载入数据并显示
Deep Learning and Unsupervised Feature Learning Tutorial Solutions
下载MINIST数据集及加载数据集的函数。MINIST数据集的介绍。
% Change the filenames if you've saved the files under different names
% On some platforms, the files might be saved as
% train-images.idx3-ubyte / train-labels.idx1-ubyte
images = loadMNISTImages('train-images.idx3-ubyte');
labels = loadMNISTLabels('train-labels.idx1-ubyte');% We are using display_network from the autoencoder code
display_network(images(:,1:100)); % Show the first 100 images
disp(labels(1:10));
修改train.m中的初始参数
visibleSize = 28*28; % number of input units 输入层单元数
hiddenSize = 196; % number of hidden units隐藏层单元数
sparsityParam = 0.1; % desired average activation of the hidden units.稀疏值% (This was denoted by the Greek alphabet rho, which looks like a lower-case "p",% in the lecture notes).
lambda = 3e-3; % weight decay parameter 权重衰减系数
beta = 3; % weight of sparsity penalty term稀疏值惩罚项的权重
修改训练集,把step1里面的patches的产生改为
%% STEP 1: Implement sampleIMAGES 第1步:实现图片采样
%实现图片采样后,函数display_network从训练集中随机显示200张
% After implementing sampleIMAGES, the display_network command should
% display a random sample of 200 patches from the dataset
%从10000张中随机选择200张显示
% patches = sampleIMAGES;
% figure
% display_network(patches(:,randi(size(patches,2),200,1)),8)
% title('sampleIMAGES')
%%为产生一个200维的列向量,每一维的值为0~10000中的随机数,说明是随机取200个patch来显示images = loadMNISTImages('train-images.idx3-ubyte');
labels = loadMNISTLabels('train-labels.idx1-ubyte');% We are using display_network from the autoencoder code
figure
display_network(images(:,1:100)); % Show the first 100 images
title('first100images')
figure
disp(labels(1:10));
title('first100label')patches=zeros(visibleSize,10000);for i=1:10000patches(:,i)=reshape(images(:,i),visibleSize,1);
end% patches = normalizeData(patches);
% 在实现手写字符识别时,是不需要对其做归一化处理的
%要清楚的是,MINIST数据集本身就已经对数据进行了归一化的处理% Obtain random parameters theta 初始化参数向量theta
theta = initializeParameters(hiddenSize, visibleSize);
为了提高效率,可把train.m中的 STEP 3: Gradient Checking这步注释掉,因为在本例中训练集更大,梯度检查会比较慢。
参考文献
https://github.com/jiandanjinxin/matlab_code-ufldl-exercise-/tree/master/vectorization_exercise
深度学习入门教程UFLDL学习实验笔记二:使用向量化对MNIST数据集做稀疏自编码
Deep Learning 2_深度学习UFLDL教程:矢量化编程(斯坦福大学深度学习教程)
吴恩达 Andrew Ng 的公开课
UFLDL教程:Exercise:Vectorization相关推荐
- UFLDL教程: Exercise: Implement deep networks for digit classification
Deep networks Deep Learning and Unsupervised Feature Learning Tutorial Solutions 深度网络的优势 比单层神经网络能学习到 ...
- UFLDL教程: Exercise:Self-Taught Learning
自我学习 Deep Learning and Unsupervised Feature Learning Tutorial Solutions 1.先训练稀疏自编码器提取特征,再把特征和label给s ...
- Python数据处理 PCA/ZCA 白化(UFLDL教程:Exercise:PCA_in_2DPCA_and_Whitening)
Python数据处理 PCA/ZCA 白化 参考材料 PCA.白化 以及一份别人的课后作业答案 UFLDL教程答案(3):Exercise:PCA_in_2D&PCA_and_Whitenin ...
- UFLDL教程: Exercise:Learning color features with Sparse Autoencoders
Linear Decoders Deep Learning and Unsupervised Feature Learning Tutorial Solutions 以三层的稀疏编码神经网络而言,在s ...
- UFLDL教程: Exercise: Sparse Autoencoder
自编码可以跟PCA 一样,给特征属性降维 一些matlab函数 bsxfun:C=bsxfun(fun,A,B)表达的是两个数组A和B间元素的二值操作,fun是函数句柄或者m文件,或者是内嵌的函数.在 ...
- UFLDL教程:数据预处理
数据预处理是深度学习中非常重要的一步!如果说原始数据的获得,是深度学习中最重要的一步,那么获得原始数据之后对它的预处理更是重要的一部分. 一般来说,算法的好坏一定程度上和数据是否归一化,是否白化有关. ...
- UFLDL教程:Exercise:Softmax Regression
Softmax分类函数的Python实现 Deep Learning and Unsupervised Feature Learning Tutorial Solutions 逻辑回归假设函数 在线性 ...
- UFLDL教程:Exercise:PCA in 2D PCA and Whitening
相关文章 PCA的原理及MATLAB实现 UFLDL教程:Exercise:PCA in 2D & PCA and Whitening python-A comparison of vario ...
- 斯坦福大学UFLDL教程列表
UFLDL教程 说明:本教程将阐述无监督特征学习和深度学习的主要观点.通过学习,你也将实现多个功能学习/深度学习算法,能看到它们为你工作,并学习如何应用/适应这些想法到新问题上. 本教程假定机器学习的 ...
最新文章
- java 线程方法join的简单总结
- EWORD 0511
- PHP实现简单的双色球机选号码
- 排序算法二:归并排序(Merge sort)
- dsp产生正弦波 c语言,TMS320C5502多波形发生器源程序 可产生正弦波,锯齿波等
- Oracle to_char() to_date() to_number()函数
- Session的原理,大型网站中Session方面应注意什么?
- decorators 参数_Python Decorators(二):Decorator参数
- 惊艳的HTML5粒子动画特效
- PHP系统发布指什么,cis系统是指什么
- hive sql列转行
- 手把手教你十分钟学会使用小程序云存储
- Win10 Delete键失效怎么办 ?
- Python爬取校花网
- 【仿真】后仿真中的notifier是奏啥滴!
- linux网络音频播放,通过 PulseAudio 实现局域网音乐播放
- 2022完整版青龙面板对接傻妞机器人
- RHEL7升级内核版本
- html input禁止驶入,layui form表单 input输入框获取焦点后 阻止Enter回车自动提交 – 执念 – 博客园...
- Consumer接口和Supplier接口
热门文章
- 命令 启动顺序_笔记一: 启动选项与系统变量
- K-periodic Garland CodeForces - 1353E(贪心)
- 池化层:最大池化MaxPool、平均池化AvgPool、自适应池化AdaptiveMaxPool区别--基于pytorch框架
- 6.Excel项目排期表
- ssh项目同时使用mysql跟sqlserver数据库_MSSQL_如何把sqlserver数据迁移到mysql数据库及需要注意事项,在项目开发中,有时由于项目 - phpStudy...
- python 获取json中最大值_详细解析 Python 爬取 bilibili 的视频、弹幕以及封面
- android 百度移动搜索 url 参数,百度刷站内快排算法参数-百度搜索URL参数比较详解...
- 读入自然数m、n,判断m/n是有限小数还是循环小数
- linux 搜索 空格,如何在Linux中搜索带有空格的模式的文件
- python完整安装顺序_Python安装与卸载流程详细步骤(图解)