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
0 个评论
回答(1 个)
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%
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!