フィルターのクリア

how to design custom ANN using Deep Network designer app MATLAB

2 ビュー (過去 30 日間)
Med Future
Med Future 2022 年 2 月 28 日
コメント済み: yanqi liu 2022 年 3 月 1 日
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 件のコメント
Med Future
Med Future 2022 年 3 月 1 日
@Abolfazl Chaman Motlagh i want input as 1x1000,
five classes have 50 samples total of 250x1000

サインインしてコメントする。

採用された回答

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 件のコメント
Med Future
Med Future 2022 年 3 月 1 日
@yanqi liu Can i divide the dataset between 80% train and 20% test?
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 Center および File ExchangePattern 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