Error using trainNetwork - invalid training data

2 visualizaciones (últimos 30 días)
Jinyang Du
Jinyang Du el 29 de Jul. de 2021
Comentada: KSSV el 29 de Jul. de 2021
layers = [
sequenceInputLayer(27)
bilstmLayer(100,"OutputMode","last")
fullyConnectedLayer(3);
softmaxLayer();
classificationLayer()
];
options = trainingOptions("adam", ...
"MaxEpochs",250, ...
"InitialLearnRate",0.005, ...
"GradientThreshold",1, ...
"Shuffle","every-epoch", ...
"Plots","training-progress", ...
"LearnRateDropPeriod",200,...
"LearnRateSchedule","piecewise");
The network I used is written above. And I tried to use net = trainNetwork(XTrain,YTrain,layers,options); to train this network. But it seems never work (I have converted table to cell before training). The training data is attached. The XTrain data is a 33750 x 27 predictor and YTrain is a 33750 x 1 respond. I intend to use this network to classify these data (predictors in X map into categories in Y). Could anyone show me how to get going? I am quite deserate by now.
  2 comentarios
KSSV
KSSV el 29 de Jul. de 2021
How did you load and arrange XTRain, YTrain. Show us the complete code.
Jinyang Du
Jinyang Du el 29 de Jul. de 2021
I just used
x = readtable('XTrain.csv');
y = readtable('YTrain.csv');
XTrain = table2cell(x);
YTrain = table2cell(y);
net = trainNetwork(XTrain,YTrain,layers,options);

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 29 de Jul. de 2021
x = readtable('XTrain.csv');
y = readtable('YTrain.csv');
XTrain = table2array(x);
YTrain = table2array(y);
XTrain = num2cell(XTrain,2) ;
XTrain = cellfun(@transpose,XTrain,'UniformOutput',false) ;
YTrain = categorical(YTrain) ;
layers = [
sequenceInputLayer(27)
bilstmLayer(100,"OutputMode","last")
fullyConnectedLayer(3);
softmaxLayer();
classificationLayer()
];
options = trainingOptions("adam", ...
"MaxEpochs",250, ...
"InitialLearnRate",0.005, ...
"GradientThreshold",1, ...
"Shuffle","every-epoch", ...
"Plots","training-progress", ...
"LearnRateDropPeriod",200,...
"LearnRateSchedule","piecewise");
net = trainNetwork(XTrain,YTrain,layers,options);
  2 comentarios
Jinyang Du
Jinyang Du el 29 de Jul. de 2021
omg thank you so much!!!
KSSV
KSSV el 29 de Jul. de 2021
Thanks is accepting/ voting the answer. :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by