Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Machine Learning for Cybersecurity

You're reading from   Hands-On Machine Learning for Cybersecurity Safeguard your system by making your machines intelligent using the Python ecosystem

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher Packt
ISBN-13 9781788992282
Length 318 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Soma Halder Soma Halder
Author Profile Icon Soma Halder
Soma Halder
Sinan Ozdemir Sinan Ozdemir
Author Profile Icon Sinan Ozdemir
Sinan Ozdemir
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Basics of Machine Learning in Cybersecurity 2. Time Series Analysis and Ensemble Modeling FREE CHAPTER 3. Segregating Legitimate and Lousy URLs 4. Knocking Down CAPTCHAs 5. Using Data Science to Catch Email Fraud and Spam 6. Efficient Network Anomaly Detection Using k-means 7. Decision Tree and Context-Based Malicious Event Detection 8. Catching Impersonators and Hackers Red Handed 9. Changing the Game with TensorFlow 10. Financial Fraud and How Deep Learning Can Mitigate It 11. Case Studies 12. Other Books You May Enjoy

Voting ensemble method to detect cyber attacks

In the voting ensemble method, every model gets to make a prediction about the results of the model, and the decision on the model result is made on the majority votes or predictions made. There is another advanced level of the voting the ensemble method known as weighted voting. Here certain predictor models have more weights associated with their votes and thus get to make more privileged predictions:

  1. We start by importing the respective libraries:
import pandas
from sklearn import model_selection
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import SVC
from sklearn.ensemble import VotingClassifier
  1. We detect a cyber attack via a voting mechanism where we use algorithms like SCV, decision tree, and logistic regression. We finally use the voting classifier to choose...
You have been reading a chapter from
Hands-On Machine Learning for Cybersecurity
Published in: Dec 2018
Publisher: Packt
ISBN-13: 9781788992282
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime