Skip to Content
Machine Learning for Cybersecurity Cookbook
book

Machine Learning for Cybersecurity Cookbook

by Emmanuel Tsukerman
November 2019
Intermediate to advanced content levelIntermediate to advanced
346 pages
9h 36m
English
Packt Publishing
Content preview from Machine Learning for Cybersecurity Cookbook

How to do it...

In the following steps, you will download a labeled dataset of counterfeit and legitimate bank notes and construct a classifier to detect counterfeit currency:

  1. Obtain a labeled dataset of authentic and counterfeit bank notes.
  2. Read in the bank note dataset using pandas:
import pandas as pddf = pd.read_csv("data_banknote_authentication.txt", header=None)df.columns = ["0", "1", "2", "3", "label"]

The following is the output:

feature 1 feature 2 feature 3 feature 4 label0 3.62160 8.6661 -2.8073 -0.44699 01 4.54590 8.1674 -2.4586 -1.46210 02 3.86600 -2.6383 1.9242 0.10645 03 3.45660 9.5228 -4.0112 -3.59440 04 0.32924 -4.4552 4.5718 -0.98880 0
  1. Create a train-test split:
from sklearn.model_selection import train_test_split
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Machine Learning for Cybersecurity

Hands-On Machine Learning for Cybersecurity

Soma Halder, Sinan Ozdemir
Machine Learning on Kubernetes

Machine Learning on Kubernetes

Faisal Masood, Ross Brigoli

Publisher Resources

ISBN: 9781789614671Supplemental Content