-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildNNs.m
41 lines (29 loc) · 1.02 KB
/
buildNNs.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function [networks] = buildNNs(NNlayers, NNperLayer, NNLR, smallNNlayers, smallNNperLayer, smallNNLR)
networks = cell(0);
% Create the large Neural Network
NNsizes = zeros(1, NNlayers) + NNperLayer;
[net] = feedforwardnet(NNsizes, 'traingd');
% Set the configuration of the large NN using arguments
net.trainParam.epochs = 100;
net.trainParam.show = NaN;
net.trainParam.showWindow = 0;
net.trainParam.showCommandLine = 0;
net.trainParam.goal = 0;
net.trainParam.lr = NNLR;
networks{1} = net;
% Create the smaller Neural Networks
for i = 1:6
smallNNsizes = zeros(1, smallNNlayers) + smallNNperLayer;
[net] = feedforwardnet(smallNNsizes, 'traingd');
% Set the configuration of the smaller NNs using arguments
net.trainParam.epochs = 100;
net.trainParam.show = NaN;
net.trainParam.showWindow = 0;
net.trainParam.showCommandLine = 0;
net.trainParam.goal = 0;
net.trainParam.lr = smallNNLR;
networks{i+1} = net;
end
% Save the networks to a file
save('networks.mat', 'networks');
end