- Mastering Machine Learning for Penetration Testing
- Chiheb Chebbi
- 127字
- 2021-06-25 21:03:09
Phishing detection with decision trees
To build the second model, we are going to use the same machine learning libraries, so there is no need to import them again. However, we are going to import the decision tree classifier from sklearn:
>>> from sklearn import tree
Create the tree.DecisionTreeClassifier() scikit-learn classifier:
classifier = tree.DecisionTreeClassifier()
Train the model:
classifier.fit(training_inputs, training_outputs)
Compute the predictions:
predictions = classifier.predict(testing_inputs)
Calculate the accuracy:
accuracy = 100.0 * accuracy_score(testing_outputs, predictions)
Then, print out the results:
print ("The accuracy of your decision tree on testing data is: " + str(accuracy))

The accuracy of the second model is approximately 90.4%, which is a great result, compared to the first model. We have now learned how to build two phishing detectors, using two machine learning techniques.
推薦閱讀
- 網絡教育學習指導
- 智能網聯汽車V2X與智能網聯設施I2X
- 數字烏托邦
- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- 新一代物聯網架構技術:分層算力網絡
- React:Cross-Platform Application Development with React Native
- 城市治理一網統管
- Building RESTful Web services with Go
- The Kubernetes Workshop
- 局域網組成實踐
- 網絡空間全球治理觀察
- 數據血緣分析原理與實踐
- 基于IPv6的家居物聯網開發與應用技術
- SRv6網絡部署指南
- React Design Patterns and Best Practices(Second Edition)