X=NSL_KDD Dataset/KDD Train.txt;T= NSL_KDD Dataset/KDD Test.
txt;X,T =NSL_KDD Dataset;rng(0,’twister’); % For reproducibilityhiddenSize = 15;autoenc1=trainAutoencoder(X,hiddenSize,’MaxEpochs’,400,.. ‘L2WeightRegularization’,0.001,… ‘SparsityRegularization’,4,.
.. ‘SparsityProportion’,0.05,… ‘DecoderTransferFunction’,’purelin’);features1 = encode(autoenc1,X);hiddenSize = 10;autoenc2 = trainAutoencoder(features1,hiddenSize,.
.. ‘L2WeightRegularization’,0.001,… ‘SparsityRegularization’,4,.
.. ‘SparsityProportion’,0.05,… ‘DecoderTransferFunction’,’purelin’,..
. ‘ScaleData’,false);features2 = encode(autoenc2,features1);softnet = trainSoftmaxLayer(features2,T,’LossFunction’,’crossentropy’);deepnet = stack(autoenc1,autoenc2,softnet);deepnet = train(deepnet,X,T);NSL_KDD_type = deepnet(X);plotconfusion(T,NSL_KDD_type); ” (a) Feature Learningfrom pre-processed data (b) Soft-max Regressionclassifier training for the derived training data Self-taught Learning(c) “Classificationusing self-taught learning Figure 3 4.2. Performance EvaluationTo ascertain the performance evaluation of STL for theNIDS, execute three types of classification(a) Normal andanomaly (2-class)(b) Normal and fourdifferent attack categories(5-class)(c) Normal and 22different attack (23- class) Evaluate the accuracy metric using the following Accuracy: “whichis the percentage of correctly classified records over the total number ofrecords. Precision (P): which is the percentage ratio of the number of “truepositives” (TP) records divided by the number of true positives (TP) and falsepositives (FP) classified records. P= Recall (R): which is the percentage ratio of number of “true positivesrecords” divided by the number of true positives and false negatives (FN)classified records. R= F-Measure(F): The harmonic mean of precision andrecall and represents a balance between them.
F= 4.2.1 Evaluation Based on training datasetCreate a 10- fold cross validation on the trainingdata to classify the accuracy of STL for 2-class,5-class and 23-class.Thereafter compare its performance with the soft-max regression when itsapplied on the NSL-NDD data set without feature learning.
Accuracy for various Classification Figure 4 If the Accuracy is evaluatedfor 2, 5, and 23-classes, the STL should achieved >98% accuracy 4. for alltypes 4.2.2 Evaluation Based on training with test datasetEvaluate the STL and SMRfor class 2 and 5 – class using the test data. Perform the accuracy metric forthe STL “Accuracyfor various Classification” Figure 5 If applied on testingand training data, the STL should achieved accuracy of ~88% for 2-class 4which is far better than other previous researched methods