官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 定州市| 新蔡县| 龙口市| 嘉鱼县| 策勒县| 汕头市| 财经| 吉安县| 永州市| 荔浦县| 板桥市| 湖州市| 阿鲁科尔沁旗| 从江县| 康马县| 老河口市| 青神县| 青州市| 河曲县| 武乡县| 莫力| 万盛区| 黔西| 招远市| 大城县| 五华县| 岳池县| 蒙自县| 翁牛特旗| 五家渠市| 鄂托克前旗| 灵武市| 麦盖提县| 吴堡县| 阜新市| 上蔡县| 宁城县| 玉屏| 丽江市| 乡城县| 屯昌县|