【DeepLearning】Exercise:Vectorization

Exercise:Vectorization

习题的链接:Exercise:Vectorization

注意点:

MNIST图片的像素点已经经过归一化。

如果再使用Exercise:Sparse Autoencoder中的sampleIMAGES.m进行归一化,

将使得训练得到的可视化权值如下图:

我的实现:

更改train.m的参数设置及训练样本选取

%% STEP 0: Here we provide the relevant parameters values that will
%  allow your sparse autoencoder to get good filters; you do not need to
%  change the parameters below.

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       

%%======================================================================
%% STEP 1: Implement sampleIMAGES
%
%  After implementing sampleIMAGES, the display_network command should
%  display a random sample of 200 patches from the dataset

% MNIST images have already been normalized
images = loadMNISTImages(‘train-images.idx3-ubyte‘);
patches = images(:,1:10000);
%display_network(patches(:,randi(size(patches,2),200,1)),8);

%  Obtain random parameters theta
theta = initializeParameters(hiddenSize, visibleSize);

训练得到的W1可视化:

时间: 2024-08-28 00:06:11

【DeepLearning】Exercise:Vectorization的相关文章

【DeepLearning】Exercise:Sparse Autoencoder

习题的链接:http://deeplearning.stanford.edu/wiki/index.php/Exercise:Sparse_Autoencoder 我的实现: sampleIMAGES.m function patches = sampleIMAGES() % sampleIMAGES % Returns 10000 patches for training load IMAGES; % load images from disk patchsize = 8; % we'll u

【DeepLearning】Exercise:PCA in 2D

Exercise:PCA in 2D 习题的链接:Exercise:PCA in 2D pca_2d.m close all %%================================================================ %% Step 0: Load data % We have provided the code to load data from pcaData.txt into x. % x is a 2 * 45 matrix, where the

【DeepLearning】Exercise: Implement deep networks for digit classification

Exercise: Implement deep networks for digit classification 习题链接:Exercise: Implement deep networks for digit classification stackedAEPredict.m function [pred] = stackedAEPredict(theta, inputSize, hiddenSize, numClasses, netconfig, data) % stackedAEPre

【DeepLearning】Exercise:PCA and Whitening

Exercise:PCA and Whitening 习题链接:Exercise:PCA and Whitening pca_gen.m %%================================================================ %% Step 0a: Load data % Here we provide the code to load natural image data into x. % x will be a 144 * 10000 matr

【DeepLearning】Exercise:Softmax Regression

Exercise:Softmax Regression 习题的链接:Exercise:Softmax Regression softmaxCost.m function [cost, grad] = softmaxCost(theta, numClasses, inputSize, lambda, data, labels) % numClasses - the number of classes % inputSize - the size N of the input vector % la

【DeepLearning】Exercise:Self-Taught Learning

Exercise:Self-Taught Learning 习题链接:Exercise:Self-Taught Learning stlExercise.m %% CS294A/CS294W Self-taught Learning Exercise % Instructions % ------------ % % This file contains code that helps you get started on the % self-taught learning. You will

【DeepLearning】Exercise:Convolution and Pooling

Exercise:Convolution and Pooling 习题链接:Exercise:Convolution and Pooling cnnExercise.m %% CS294A/CS294W Convolutional Neural Networks Exercise % Instructions % ------------ % % This file contains code that helps you get started on the % convolutional n

【DeepLearning】Exercise:Learning color features with Sparse Autoencoders

Exercise:Learning color features with Sparse Autoencoders 习题链接:Exercise:Learning color features with Sparse Autoencoders sparseAutoencoderLinearCost.m function [cost,grad] = sparseAutoencoderLinearCost(theta, visibleSize, hiddenSize, ... lambda, spar

【UFLDL】Exercise: Convolutional Neural Network

这个exercise需要完成cnn中的forward pass,cost,error和gradient的计算.需要弄清楚每一层的以上四个步骤的原理,并且要充分利用matlab的矩阵运算.大概把过程总结了一下如下图所示: STEP 1:Implement CNN Objective STEP 1a: Forward Propagation Forward Propagation主要是为了计算输入图片经过神经网络后的输出,这个网络有三层:convolution->pooling->softmax(