How Can i train pattern recognition/Feedforward Neural net on my own dataset

1 次查看(过去 30 天)
Hello everyone , i hope you are doing well
I have the following dataset, i want to train a pattern recognition network.
I have the dataset which contains 3 classes and dataset shape is 1000x3000 and also label shape is 3x3000
I want to classify pattern of numeric numbers each column has belong to specific class.
Please can anybody help me

回答(1 个)

yanqi liu
yanqi liu 2022-3-9
yes,sir,may be use nnet can get simple process,such as
warning off all
load FInalDataset.mat
[~,Y] = max(labels);
X = dataset;
% make data shuffle
rand('seed', 0)
ind = randperm(size(X, 2));
X = X(:,ind);
Y = Y(ind);
% Split Data
rate = 0.5;
ind_split = round(length(Y)*rate);
train_X = X(:,1:ind_split);
train_Y = Y(1:ind_split);
test_X = X(:,ind_split+1:end);
test_Y = Y(ind_split+1:end);
% init process
[pn,minp,maxp,tn,mint,maxt] = premnmx(train_X, train_Y);
% set net parameters
NodeNum1 = 40;
NodeNum2 = 20;
TypeNum = 1;
TF1 = 'tansig';
TF2 = 'tansig';
TF3 = 'tansig';
bp_net = newff(minmax(pn), [NodeNum1,NodeNum2,TypeNum], {TF1 TF2 TF3}, 'traingdx');
bp_net.trainParam.show = 50;
bp_net.trainParam.epochs = 10000;
bp_net.trainParam.goal = 1e-4;
bp_net.trainParam.lr = 0.05;
% train net
bp_net = train(bp_net, pn,tn);
% test net
p2n = tramnmx(test_X,minp, maxp);
y2n = sim(bp_net, p2n);
y2n = postmnmx(y2n,mint,maxt);
T = [test_Y; round(y2n)];
acc = (sum(T(1, :)-T(2, :) == 0)/numel(T(1, :)))*100;
fprintf('\nacc rate is %.2f%%\n', acc);
acc rate is 76.27%
  4 个评论
Med Future
Med Future 2022-3-10
@yanqi liu i have tried to make more hidden layers but model overfit.
Can you please do an experiment to increase accruacy?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by