How to use batch-size concept in this regression model?
1 回表示 (過去 30 日間)
古いコメントを表示
1. I tried to make a simple regression model with this dataset.
total data length is 1920 for each column.
(i.e, 1920x5 is the total dataset size)
The first four datas(Dia, xcor, ycor, freq) are used as inputs.
And the last one, Y is used as output
With four inputs I want my model to make an estimated Y value.
Then MSE can be calculated with true Y in the table.
The model can be trained by minimizing error.
2.
This is my code I tried.
clear all
inputSize = 4;
numHiddenNode=64;
layers = [ ...
imageInputLayer([1 inputSize], 'Name', 'Input')
fullyConnectedLayer(numHiddenNode, 'Name', 'FC_1','WeightsInitializer','glorot')
reluLayer('Name','relu_1')
regressionLayer('Name','reg_1')
]
%% Load data.
DataDir = 'D:\13_2_single_freq_log';
Freq=100;
CSV = csvread([DataDir '\Test_log_' num2str(Freq) '.csv']);
[CSVrow, CSVcol] = size(CSV);
dia = zeros(CSVrow,1);
xcor = zeros(CSVrow,1);
ycor = zeros(CSVrow,1);
freq = zeros(CSVrow,1);
Y = zeros(CSVrow,1);
dia = CSV(:,1);
xcor = CSV(:,2);
ycor = CSV(:,3);
freq = CSV(:,4);
Y = CSV(:,5);
inputs=[dia xcor ycor freq];
targets = transpose(Y);
%% Training option
options = trainingOptions('adam', ...
'InitialLearnRate',0.001, ...
'MiniBatchSize',100, ...
'MaxEpochs',4, ...
'Shuffle','every-epoch', ...
'Verbose',true, ...
'VerboseFrequency',10, ...
'Plots','training-progress');
%% Training
lgraph = layerGraph(layers);
net = trainNetwork(inputs,targets,lgraph,options); % This line is the problem.
3.
and this error was displayed
Error using trainNetwork (line 165)
The training images are of size 1920x4x1 but the input layer expects images of size 1x4x1.
I want to use batch-size feature.
so that even if I put 1920 length inputs, but the code automatically split them to proper size.
(1x4x1 is too small I think. I want this model to be trained with 100 batch size.)
How could I solve this problem??
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!