**5. Result and discussion**

In this section, the experimental results of our machine learning techniques with four class classification methodology using NSL-KDD intrusion detection dataset are provided in order to detect network intrusions and then comparison with the existing approaches is done to evaluate the efficacy of our network intrusion detection model. Confusion matrix is drawn for each type of attack and their faults of all four classifiers. So we obtain 16 set of confusion matrix a n d which are presented in this study. The performance of the classifiers is measured in terms of Confusion matrix,

### *Efficient Machine Learning Classifier for Fault Detection in Wireless Sensor Networks DOI: http://dx.doi.org/10.5772/intechopen.111462*

Accuracy, Precision, Recall, F-measure, Specificity, Selectivity, G-mean. After the classifiers are trained the performance of all 4 classifiers are measured in terms of these metrics using test data set.

All the experiments are conducted using NSL-KDD dataset that has 125,973 training instances, 22,544 instances for testing with 41 attributes and 4 attack types for four classifiers to build an efficient network fault detection system. We have evaluated all algorithms with various evaluation measures, as discussed in the above section.

Confusion matrix for Random Forest:

Confusion matrix for major types of faults is shown in the **Figures 2**–**5**. For U2R attack the True negative is zero since the fault data is very low compared to the normal data, In R2L also number of fault data is very low, therefore the true negative value is low. In DoS and Probe attack also number of False positive data is more therefore the accuracy will be less. In the similar way the Confusion matrix for other classifiers are also constructed.

**Tables 3**–**6** show the performance of the all 4 classifiers and from the result obtained we see the MLP classifier performs better than the other Classifier. False positive rate is less for MLP Classifier, True Positive and True Negative values are more. Therefore, MLP classifier is efficient classifier for fault detection Wireless Sensor Networks. The comparative plot of Accuracy for all 4 types of classifier algorithm is shown in the **Figure 6**, and it's evident that MLP on an average has an accuracy of 89.725%.

**Figure 2.** *U2R attack for RF.*

**Figure 3.** *R2L attack for RF.*

**Figure 4.** *Probe attack for RF.*

The performance of the classifiers is also studied by introducing different Fault Probability Rates (FPR) and the results of the same are shown in **Tables 7**–**10**. The major goal of the fault percentage variation is that how accurately a classifier classifies the attack or normal data irrespective of the percentage of the fault present in particular test data. In the present study a classifier classifies the data with good amount of accuracy even if the percentage of fault is high.


**Table 3.** *Accuracy for random Forest classifier.* *Efficient Machine Learning Classifier for Fault Detection in Wireless Sensor Networks DOI: http://dx.doi.org/10.5772/intechopen.111462*


#### **Table 4.**

*Accuracy for support vector machine classifier.*


#### **Table 5.**

*Accuracy for MLP classifier.*


#### **Table 6.**

*Accuracy for SGD classifier.*

**Figure 6.** *Comparison of accuracy for all four classifiers.*


#### **Table 7.**

*Performance of RF for varying fault rate.*


#### **Table 8.**

*Performance of SVM for varying fault rate.*


#### **Table 9.**

*Performance of MLP for varying fault rate.*
