Each time getting different prediction results using trainNetwork.
Show older comments
clc;
datafolder='C:\Users\DataSet\';
x_train=xlsread(strcat(datafolder,'train_data.xlsx'),'B2:BFN5878');
x_test=xlsread(strcat(datafolder,'test_data.xlsx'),'B2:BFN5878');
y_train=xlsread(strcat(datafolder,'train_scores.csv'),'B2:F5878');
x_train_reshape = reshape(x_train',[39 39 1 5877]);
x_test_reshape = reshape(x_test',[39 39 1 5877]);
y_train_var1 = y_train(:,1);
x_train_reshape = reshape(x_train',[39 39 1 5877]);
x_test_reshape = reshape(x_test',[39 39 1 5877]);
y_train_age = y_train(:, 1);
firstConvLayerFiltNum = 20;
layers = [...
imageInputLayer([39 39 1])
convolution2dLayer(5, 20)
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
fullyConnectedLayer(1)
regressionLayer];
options = trainingOptions('sgdm', 'Plots', 'training-progress', ...
'Momentum', 0.9, ...
'InitialLearnRate', 0.001, ... %0.001
'LearnRateSchedule', 'piecewise', ...
'LearnRateDropFactor', 1, ... %0.1
'LearnRateDropPeriod', 1, ... %8
'L2Regularization', 0.004, ...
'MaxEpochs', 1, ... %40
'MiniBatchSize', 10, ...
'Verbose', true);
net = trainNetwork(x_train_reshape, y_train_var1, layers, options);
YPred = predict(net, x_test_reshape);
xlswrite('C:\Users\DataSet\prediction_files\predict_var1.csv', YPred);
Accepted Answer
More Answers (0)
Categories
Find more on Function Approximation and Clustering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!