Effacer les filtres
Effacer les filtres

how to design custom ANN using Deep Network designer app MATLAB

2 vues (au cours des 30 derniers jours)
Med Future
Med Future le 28 Fév 2022
Commenté : yanqi liu le 1 Mar 2022
Hello Everyone, I Hope you are doing well.
I want to create a simple ANN using Deep network Designer app or using code.
ANN contain input layer, 10 neurons in hidden layer with sigmoid activation and output layer with classifciaton and softmax layer
I have the dataset of shape 250x1000. I have attached the dataset below. which contain label as well.
I also want to be label in catogorical form . Like 1 name as 'Class1'
How can i do it in MATLAB
  1 commentaire
Med Future
Med Future le 1 Mar 2022
@Abolfazl Chaman Motlagh i want input as 1x1000,
five classes have 50 samples total of 250x1000

Connectez-vous pour commenter.

Réponse acceptée

yanqi liu
yanqi liu le 1 Mar 2022
clc; clear all; close all;
load Datasetn
layers = [
imageInputLayer([1000 1 1])
fullyConnectedLayer(10)
reluLayer
fullyConnectedLayer(5)
softmaxLayer
classificationLayer];
opts = trainingOptions('adam', ...
'MaxEpochs',200, ...
'Shuffle','every-epoch', ...
'Plots','training-progress', ...
'Verbose',false, ...
'ExecutionEnvironment', 'cpu', ...
'ValidationPatience',Inf);
xc = reshape(dataset', [1000,1,1,250]);
% 'Class1'
yc = [];
for i = 1 : length(label)
yc{i,1} = ['Class' num2str(double(label(i)))];
end
yc = categorical(yc);
disp(yc)
net = trainNetwork(xc,yc,layers,opts);
  2 commentaires
Med Future
Med Future le 1 Mar 2022
@yanqi liu Can i divide the dataset between 80% train and 20% test?
yanqi liu
yanqi liu le 1 Mar 2022
yes,sir
clc; clear all; close all;
load Datasetn
idx = randperm(length(label)) ;
dataset = dataset(idx,:);
label = label(idx,:);
m = round(length(label)*0.8) ;
dataset1 = dataset(1:m,:); label1 = label(1:m,:);
dataset2 = dataset(1+m:end,:); label2 = label(1+m:end,:);
layers = [
imageInputLayer([1000 1 1])
fullyConnectedLayer(10)
reluLayer
fullyConnectedLayer(5)
softmaxLayer
classificationLayer];
opts = trainingOptions('adam', ...
'MaxEpochs',200, ...
'Shuffle','every-epoch', ...
'Plots','training-progress', ...
'Verbose',false, ...
'ExecutionEnvironment', 'cpu', ...
'ValidationPatience',Inf);
xc = reshape(dataset1', [1000,1,1,m]);
% 'Class1'
yc = [];
for i = 1 : length(label1)
yc{i,1} = ['Class' num2str(double(label1(i)))];
end
yc = categorical(yc);
disp(yc)
net = trainNetwork(xc,yc,layers,opts);

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by