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

4 views (last 30 days)
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

Answers (1)

yanqi liu
yanqi liu on 9 Mar 2022
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 Comments

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by