Skip to content

Commit 5be78ce

Browse files
updated readme
1 parent 5c35ac9 commit 5be78ce

File tree

1 file changed

+39
-18
lines changed

1 file changed

+39
-18
lines changed

README.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ For a more informal introduction, see the following videos by Geoffrey Hinton an
1515
* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)
1616
* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)
1717

18-
If you use this toolbox in your research please cite:
18+
If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)
1919

20-
[Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284) (Palm, 2012)
20+
```
21+
@MASTERSTHESIS\{IMM2012-06284,
22+
author = "R. B. Palm",
23+
title = "Prediction as a candidate for learning deep hierarchical models of data",
24+
year = "2012",
25+
```
2126

2227
Directories included in the toolbox
2328
-----------------------------------
@@ -85,15 +90,16 @@ dbn = dbntrain(dbn, train_x, opts);
8590
8691
%unfold dbn to nn
8792
nn = dbnunfoldtonn(dbn, 10);
93+
nn.normalize_input = 0;
94+
nn.activation_function = 'sigm';
8895
8996
%train nn
90-
nn.learningRate = 1;
9197
opts.numepochs = 1;
9298
opts.batchsize = 100;
9399
nn = nntrain(nn, train_x, train_y, opts);
94100
[er, bad] = nntest(nn, test_x, test_y);
95101
96-
assert(er < 0.12, 'Too big error');
102+
assert(er < 0.10, 'Too big error');
97103
98104
```
99105

@@ -114,25 +120,28 @@ test_y = double(test_y);
114120
% Setup and train a stacked denoising autoencoder (SDAE)
115121
rng(0);
116122
sae = saesetup([784 100]);
123+
sae.ae{1}.normalize_input = 0;
124+
sae.ae{1}.activation_function = 'sigm';
117125
sae.ae{1}.learningRate = 1;
118126
sae.ae{1}.inputZeroMaskedFraction = 0.5;
119127
opts.numepochs = 1;
120128
opts.batchsize = 100;
121129
sae = saetrain(sae, train_x, opts);
122-
visualize(sae.ae{1}.W{1}')
130+
visualize(sae.ae{1}.W{1}(:,2:end)')
123131
124132
% Use the SDAE to initialize a FFNN
125133
nn = nnsetup([784 100 10]);
134+
nn.normalize_input = 0;
135+
nn.activation_function = 'sigm';
136+
nn.learningRate = 1;
126137
nn.W{1} = sae.ae{1}.W{1};
127-
nn.b{1} = sae.ae{1}.b{1};
128138
129139
% Train the FFNN
130-
nn.learningRate = 1;
131140
opts.numepochs = 1;
132141
opts.batchsize = 100;
133142
nn = nntrain(nn, train_x, train_y, opts);
134143
[er, bad] = nntest(nn, test_x, test_y);
135-
assert(er < 0.21, 'Too big error');
144+
assert(er < 0.16, 'Too big error');
136145
137146
```
138147

@@ -193,44 +202,56 @@ test_y = double(test_y);
193202
%% ex1 vanilla neural net
194203
rng(0);
195204
nn = nnsetup([784 100 10]);
196-
197-
nn.learningRate = 1; % Learning rate
198205
opts.numepochs = 1; % Number of full sweeps through data
199206
opts.batchsize = 100; % Take a mean gradient step over this many samples
200-
opts.silent = 1;
201-
nn = nntrain(nn, train_x, train_y, opts);
207+
[nn, L] = nntrain(nn, train_x, train_y, opts);
202208
203209
[er, bad] = nntest(nn, test_x, test_y);
204-
assert(er < 0.1, 'Too big error');
210+
211+
assert(er < 0.08, 'Too big error');
212+
205213
206214
%% ex2 neural net with L2 weight decay
207215
rng(0);
208216
nn = nnsetup([784 100 10]);
209217
210218
nn.weightPenaltyL2 = 1e-4; % L2 weight decay
211-
nn.learningRate = 1; % Learning rate
212219
opts.numepochs = 1; % Number of full sweeps through data
213220
opts.batchsize = 100; % Take a mean gradient step over this many samples
214-
opts.silent = 1;
221+
215222
nn = nntrain(nn, train_x, train_y, opts);
216223
217224
[er, bad] = nntest(nn, test_x, test_y);
218225
assert(er < 0.1, 'Too big error');
219226
227+
220228
%% ex3 neural net with dropout
221229
rng(0);
222230
nn = nnsetup([784 100 10]);
223231
224232
nn.dropoutFraction = 0.5; % Dropout fraction
225-
nn.learningRate = 1; % Learning rate
226233
opts.numepochs = 1; % Number of full sweeps through data
227234
opts.batchsize = 100; % Take a mean gradient step over this many samples
228-
opts.silent = 1;
235+
229236
nn = nntrain(nn, train_x, train_y, opts);
230237
231238
[er, bad] = nntest(nn, test_x, test_y);
232-
assert(er < 0.16, 'Too big error');
239+
assert(er < 0.1, 'Too big error');
240+
241+
%% ex4 neural net with sigmoid activation function, and without normalizing inputs
242+
rng(0);
243+
nn = nnsetup([784 100 10]);
233244
245+
nn.activation_function = 'sigm'; % Sigmoid activation function
246+
nn.normalize_input = 0; % Don't normalize inputs
247+
nn.learningRate = 1; % Sigm and non-normalized inputs require a lower learning rate
248+
opts.numepochs = 1; % Number of full sweeps through data
249+
opts.batchsize = 100; % Take a mean gradient step over this many samples
250+
251+
nn = nntrain(nn, train_x, train_y, opts);
252+
253+
[er, bad] = nntest(nn, test_x, test_y);
254+
assert(er < 0.1, 'Too big error');
234255
```
235256

236257

0 commit comments

Comments
 (0)