use trainnetwork for normal regression
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Yunyu Hu
le 3 Mar 2020
Modifié(e) : wahed fazeli
le 30 Mai 2020
Hi,
I have a dataset of 63 inputs and 1 output for a regression problem. Total sample 39686.
X: 63x39686
Y: 1x39686
I can easily use "net=fitnet(...)" and "train(net X,Y)" to train the model.
But I want to try the trainnetwork function. After configuring the layers like this:
layers = [
sequenceInputLayer(size(X,1),"Name","sequence_In","Normalization","rescale-zero-one")
fullyConnectedLayer(20,"Name","fc_1")
fullyConnectedLayer(20,"Name","fc_2")
regressionLayer("Name","regressionoutput")];
and options:
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.001, ...
'Verbose',false, ...
'Plots','training-progress');
Then I train the model:
net = trainNetwork(X,Y,layers,options);
But it always shows :
To RESHAPE the number of elements must not change.
Error in NN_training_deep (line 33)
net = trainNetwork(X_,Y',layers,options);
Does anyone know how to solve this problem?
0 commentaires
Réponse acceptée
Srivardhan Gadila
le 6 Mar 2020
The outputSize argument for the fullyConnectedLayer before the regressionLayer must be 1 as the number of ouputs for your regression problem is 1.
layers = [
sequenceInputLayer(size(X,1),"Name","sequence_In","Normalization","rescale-zero-one")
fullyConnectedLayer(20,"Name","fc_1")
fullyConnectedLayer(20,"Name","fc_2")
fullyConnectedLayer(1,"Name","fc_3")
regressionLayer("Name","regressionoutput")];
3 commentaires
Srivardhan Gadila
le 6 Mar 2020
The loss seems very high, try normalizing the data.
Also refer to the following links:
wahed fazeli
le 30 Mai 2020
Modifié(e) : wahed fazeli
le 30 Mai 2020
I have a dataset of 9 inputs and 1 output for training data. Total sample 488
B: 9x488
F: 1x488
I want to train my data using deep learning but when i want to do that .matlab r2018b give me nothing.
these are codes of matlab.
Firstly i have used this code but it gave me some errors.
layers = [
sequenceInputLayer(size(B,1),"Name","sequence_In","Normalization","rescale-zero-one")
fullyConnectedLayer(20,"Name","fc_1")
fullyConnectedLayer(20,"Name","fc_2")
fullyConnectedLayer(1,"Name","fc_3")
regressionLayer("Name","regressionoutput")];
Error using sequenceInputLayer>iParseInputArguments (line 41)
'Normalization' is not a recognized parameter. For a list of valid name-value pair arguments, see the documentation
for this function.
Error in sequenceInputLayer (line 26)
inputArguments = iParseInputArguments(varargin{:});
so i have changed the code and write this code.so it worked at first.
layers = [
sequenceInputLayer(size(b,1),"Name","sequence_In")
fullyConnectedLayer(20,"Name","fc_1")
fullyConnectedLayer(20,"Name","fc_2")
fullyConnectedLayer(1,"Name","fc_3")
regressionLayer("Name","regressionoutput")];
and write this code for options.
option=trainingOptions('sgdm','MaxEpochs',20,'InitialLearnRate',0.001,'Verbose',false,'Plots','training-progress');
net=trainNetwork(B,F,layers,option);
when i run this code the matlab give me nothing in result.the version of matlab i have used is R2018b
validation RMSE: N/A and other parameters this is the snap shot of results.I dont know what is problem.can anyone help me fix this error .thanks.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/306427/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/306427/image.jpeg)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!