KDD data set normalization

pls i need you guys help on how to normalize the KDD cup data set, or is some thing wrong with the code i have below.
% read excel file file from computer directory.
INPUT_P= xlsread('C:\Users\5GPROGRAMER\Desktop\WORKING DIRECTORY\PROJECT WORKING DIRECTORY\TRAINING DATA\TRAIN DATA1.xlsx');
TARGET_T= xlsread('C:\Users\5GPROGRAMER\Desktop\WORKING DIRECTORY\PROJECT WORKING DIRECTORY\TRAINING DATA\OUTPUT BINARY CODE2.xlsx');
TEST_DATA= xlsread('C:\Users\5GPROGRAMER\Desktop\WORKING DIRECTORY\PROJECT WORKING DIRECTORY\TRAINING DATA\sample test.xlsx');
% convert excel file to matrix ivp and ivt
ivp=INPUT_P';
ivt=TARGET_T';
testinputs=TEST_DATA';
% start data set normalization
[pn,minp,maxp,tn,mint,maxt]=premnmx(ivp,ivt);
% creat neural network
net=newff(minmax(pn),[5 5],{'tansig','purelin'},'trainrp')

1 Comment

Am working on neural network using Back propagation to detect threat, and am working with the KDD data set. But each time i test the neural network with the test data set, its not giving the accurate result. Below is the full code of the work i have been doing.
% read excel file file from computer directory.
INPUT_P= xlsread('C:\Users\5GPROGRAMER\Desktop\WORKING DIRECTORY\PROJECT WORKING DIRECTORY\TRAINING DATA\TRAIN DATA1.xlsx');
TARGET_T= xlsread('C:\Users\5GPROGRAMER\Desktop\WORKING DIRECTORY\PROJECT WORKING DIRECTORY\TRAINING DATA\OUTPUT BINARY CODE2.xlsx');
TEST_DATA= xlsread('C:\Users\5GPROGRAMER\Desktop\WORKING DIRECTORY\PROJECT WORKING DIRECTORY\TRAINING DATA\sample test.xlsx');
% convert excel file to matrix ivp and ivt
ivp=INPUT_P';
ivt=TARGET_T';
testinputs=TEST_DATA';
[pn,minp,maxp,tn,mint,maxt]=premnmx(ivp,ivt);
net=newff(minmax(pn),[5 5],{'tansig','purelin'},'trainrp')
% learning rate parameter for neural network
net.trainParam.epochs=100;
net.trainParam.lr=5.0;
net.trainParam.mc=0.6;
%train neural network (net).
net = train(net,pn,tn);
out = sim(net,testinputs);
[dummy, I]=max(out);
if (I == 1 ) h = msgbox('ATTENTION: NORMAL PACKET','Description','none'); elseif (I == 2) h = msgbox('ATTENTION: NEPTUNE ATTACK','Description','none'); elseif (I== 3) h = msgbox('ATTENTION: REMOTE TO LOCAL ATTACK','Description','none'); elseif (I== 4) h = msgbox('ATTENTION: PROBE ATTACK','Description','none'); elseif (I== 5) h = msgbox('ATTENTION: USER TO REMOTE ATTACK','Description','none'); else h = msgbox('UNCLASSIFIED ATTACK','Description','none');

Sign in to comment.

 Accepted Answer

Greg Heath
Greg Heath on 4 Jul 2013
1. I do not see where you have confirmed that you have obtained acceptable results from training. Where do you compare training output trainout = sim(net,ivp) with the training target ivt? Is
NMSE = mse(ivt-trainout)/mean(var(ivt',1)) << 1 ?
2. To use the testinput you have to normalize it, use sim, then unnormalize the answer.
Hope this helps.
Thank you for formally accepting my answer
Greg

3 Comments

What version of the Toolbox do you have? That version of NEWFF has been obsolete for many years. The more recent version is also obsolete. The current MLP for regression and curvefitting is FITNET.
the problem i have is the normalization, am not sure if this is correct [pn,minp,maxp,tn,mint,maxt]=premnmx(ivp,ivt);
am using Matlab 7.8.0 (R2009a)

Sign in to comment.

More Answers (1)

Greg Heath
Greg Heath on 8 Jul 2013
Read the documentation on premnmx. Not only is it obsolete, it has a bug. Use mapminmax instead
help premnmx
doc premnmx
help mapminmax
doc mapminmax
Hope this helps.
Greg
PS. Always read the documentation if you have traced a problem to a particular function. If push comes to shove, you can always read the source code using the command type.

1 Comment

thanks very much i used mapminmax() and it worked

Sign in to comment.

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!