-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseline_trainAndValidate.m
54 lines (33 loc) · 1.01 KB
/
baseline_trainAndValidate.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
41
42
43
44
rng('default')
disp('Creating train and validation datastores...')
sampleSize = 12560;
[fdsTrainCombined, fdsValCombined] = createTrainValidationDatastores(sampleSize);
% Create and train a network
options = trainingOptions(...
'adam',...
'InitialLearnRate',0.0005,...
'ValidationData', fdsValCombined,...
'MiniBatchSize', 64, ...
'MaxEpochs', 9, ...
'Plots','none', ...
'Verbose',true);
numWavelengths = 55;
numFeatures = 300;
layers = [
sequenceInputLayer(numFeatures)
fullyConnectedLayer(1024)
reluLayer()
fullyConnectedLayer(256)
reluLayer()
fullyConnectedLayer(1)
regressionLayer
];
net = trainNetwork(fdsTrainCombined,layers,options);
%save('baseline_trainedNet','net')
disp('Computing predictions on validation set...')
% Do some predictions
targs = readall(fdsValCombined.UnderlyingDatastores{2});
predsVal = predict(net, fdsValCombined);
disp('Computing Ariel score on validation set...')
predsVal = predsVal';
score = arielMetric(predsVal, targs)