how to design custom ANN using Deep Network designer app MATLAB

2 次查看(过去 30 天)
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

采纳的回答

yanqi liu
yanqi liu 2022-3-1
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 个评论
yanqi liu
yanqi liu 2022-3-1
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);

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Pattern Recognition and Classification 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by