December 2018
Intermediate to advanced
318 pages
8h 28m
English
We will now use another machine learning approach to detect malicious URLs. Support vector machines (SVMs) are a popular method for classifying whether a URL is malicious or benign.
An SVM model classifies data across two or more hyperplanes. The output of the model is a hyperplane that can be used to segregate the input dataset, as shown in the following graph:

We then import the required packages. The SVM package available in the sklearn package (as shown in the following code) is very useful for this purpose:
#use SVMfrom sklearn.svm import SVCsvmModel = SVC()svmModel.fit(X_train, y_train)#lsvcModel = svm.LinearSVC.fit(X_train, ...
Read now
Unlock full access