-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateNet.m
More file actions
34 lines (25 loc) · 901 Bytes
/
Copy pathCreateNet.m
File metadata and controls
34 lines (25 loc) · 901 Bytes
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
clear all
close all
clc
DataSet=load('.\..\FeaturesSet\VggF_ProblemSet.mat');
NetDir='.\..\Observations\Total Features\';
mkdir('.\..\Observations\Total Features\')
% create a neural network
neuronsXLayer = [30]; % number of neurons per layer
neuronTransferFunction{1} = 'tansig';
neuronTransferFunction{2} = 'tansig';
net = feedforwardnet(neuronsXLayer,'trainscg');
% training and testing data
net.divideParam.trainRatio = 1;
net.divideParam.testRatio = 0;
net.divideParam.valRatio = 0;
net.trainParam.epochs = 1000;
net.trainParam.goal = 0.01;
for iL = 1: size(neuronsXLayer,2)
net.layers{iL}.transferFcn = neuronTransferFunction{iL};
end
% train FFNNs for Age and Gender
AgeNet = train(net,DataSet.p',DataSet.age');
save ([NetDir 'AgeNet.mat'], AgeNet);
GenderNet = train(net,DataSet.p',DataSet.gender');
save ([NetDir 'GenderNet.mat'], GenderNet);