Borrar filtros
Borrar filtros

how to design custom ANN using Deep Network designer app MATLAB

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

yanqi liu
yanqi liu el 1 de Mzo. de 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 comentarios
Med Future
Med Future el 1 de Mzo. de 2022
@yanqi liu Can i divide the dataset between 80% train and 20% test?
yanqi liu
yanqi liu el 1 de Mzo. de 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);

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by