Neural network clasifing everything into one class (streamlined the problem)
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi my NN clasifies everything into one class, it does not seem to be learning at all, could you hint me where the problem could be please? I tried everything...No matter the architecture of the neural network it does the same thing, so I think I must use it wrong in some way....If I use patternet the clasification works...
load('workspace2.mat')
%%
lgraph = layerGraph();
tempLayers = [
featureInputLayer(29,"Name","featureinput")
fullyConnectedLayer(32,"Name","fc_1")
fullyConnectedLayer(64,"Name","fc_5")
fullyConnectedLayer(128,"Name","fc_2")
fullyConnectedLayer(2,"Name","fc_3")
classificationLayer("Name","classoutput")];
lgraph = addLayers(lgraph,tempLayers);
plot(lgraph)
analyzeNetwork(lgraph)
%%
categor = categorical(I) ;
X1TrainM = data1;
TTrainM = categor;
dsX1TrainM = arrayDatastore(X1TrainM,IterationDimension=2);
dsTTrainM = arrayDatastore(TTrainM,IterationDimension=2);
options = trainingOptions("sgdm", ...
MaxEpochs=15, ...
InitialLearnRate=0.0000001, ...
Plots="training-progress", ...
Shuffle="every-epoch",...
Verbose=1);
dsTrain = combine(dsX1TrainM,dsTTrainM);
net = trainNetwork(dsTrain,lgraph,options);
YPredicted = classify(net,dsTrain);
plotconfusion(categor',YPredicted)
%This works
t = zeros(2,length(I));
for ind = 1:1:length(I)
t(I(ind),ind) = 1;
end
x = data1;
net = patternnet([64,128,256]);
net.trainParam.max_fail = 20;
net = train(net,x,t);
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!