Step 2 – writing the code to train and test our model

The following code is identical to what we discussed in the section on NLP, with a few additions where we are using pickle.dump to save the trained model in a file. We also use pickle.load to load the saved model:

The following screenshot shows the results, in the form of a confusion matrix given by our trained model for the dataset. We trained the model on 80% of our dataset, specified by 0.8, and tested it on 20%, specified by 0.2. The result set obtained suggests that we have a 92% accuracy rate with the model prediction. It should be noted that the accuracy may vary for a larger dataset. The idea here was to give you an understanding of how NLP can be used with penetration testing reports. We can improve the processing to give cleaner data and change the choice of model to arrive at better results:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.182.45