Exercise:Vectorization
习题的链接:Exercise:Vectorization
注意点:
MNIST图片的像素点已经经过归一化。
如果再使用Exercise:Sparse Autoencoder中的sampleIMAGES.m进行归一化,
将使得训练得到的可视化权值如下图:
更改train.m的参数设置
visibleSize = *; % number of input units
hiddenSize = ; % 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-; % weight decay parameter
beta = ; % weight of sparsity penalty term
更改sampleIMAGES.m
function patches = sampleIMAGES()
% sampleIMAGES
% Returns patches for training load images; % load images from disk patchsize = ; % we'll use 28x28 patches
numpatches = ; % Initialize patches with zeros. Your code will fill in this matrix--one
% column per patch, columns.
patches = zeros(patchsize*patchsize, numpatches); %% ---------- YOUR CODE HERE --------------------------------------
% Instructions: Fill in the variable called "patches" using data
% from images. patches = images(:, :);
训练得到的W1可视化: