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

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.

主站蜘蛛池模板: 保靖县| 息烽县| 台北县| 集贤县| 石渠县| 临高县| 明溪县| 昌吉市| 贵阳市| 汾阳市| 荃湾区| 新安县| 科技| 兴业县| 军事| 镶黄旗| 湄潭县| 获嘉县| 白水县| 新郑市| 北辰区| 汝南县| 海淀区| 鄢陵县| 工布江达县| 保康县| 保定市| 岳普湖县| 虞城县| 海丰县| 禄丰县| 谢通门县| 东乡| 游戏| 瓮安县| 华蓥市| 山丹县| 龙山县| 福清市| 新干县| 鹤山市|