教程地址:http://deeplearning.stanford.edu/wiki/index.php/UFLDL_Tutorial
Exercise地址:http://deeplearning.stanford.edu/wiki/index.php/Exercise:Sparse_Autoencoder
代码
实现的时候就尽量没用loop循环,能向量化实现的地方尽量用了向量化实现。
Step 1: Generate training set (sampleIMAGES.m. )
随机采样1000个图像块
for i=1:numpatches
r = 0;
imth = randi([1,10],1);
patchth1 = randi([1,504],1);
patchth2 = randi([1,504],1);
for j = patchth1:(patchth1+7)
for k = patchth2:(patchth2+7)
r = r+1;
patches(r,i)=IMAGES(j,k,imth);
end
end
end