August 2019
Intermediate to advanced
342 pages
9h 35m
English
We will now see the use of decision trees in the task of phishing detection. As we said in the previous paragraphs, phishing detection (as well as spam filtering) basically involves the classification of input data:
import pandas as pdimport numpy as npfrom sklearn import *from sklearn.linear_model import LogisticRegressionfrom sklearn.metrics import accuracy_scorephishing_dataset = np.genfromtxt('../datasets/phishing_dataset.csv', delimiter=',', dtype=np.int32)samples = phishing_dataset[:,:-1]targets = phishing_dataset[:, -1]from sklearn.model_selection import train_test_splittraining_samples, testing_samples, training_targets, testing_targets =train_test_split(samples, targets, test_size=0.2, random_state=0) ...Read now
Unlock full access