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

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.

主站蜘蛛池模板: 观塘区| 汽车| 长泰县| 潍坊市| 宜黄县| 郧西县| 寿光市| 玉环县| 武乡县| 五家渠市| 武乡县| 桐梓县| 常宁市| 明水县| 吉林市| 本溪市| 宁晋县| 宣威市| 通河县| 白朗县| 虹口区| 大理市| 诸暨市| 石景山区| 米易县| 于都县| 喜德县| 安康市| 天全县| 福安市| 法库县| 金堂县| 大城县| 黄冈市| 青神县| 杨浦区| 松原市| 长乐市| 桃源县| 登封市| 剑河县|