Reader small image

You're reading from  Hands-On Artificial Intelligence for Cybersecurity

Product typeBook
Published inAug 2019
Reading LevelBeginner
PublisherPackt
ISBN-139781789804027
Edition1st Edition
Languages
Right arrow
Author (1)
Alessandro Parisi
Alessandro Parisi
author image
Alessandro Parisi

Alessandro Parisi has been an IT professional for over 20 years, acquiring significant experience as a Security Data Scientist, and as an Artificial Intelligence Cybersecurity and Blockchain specialist. He has experience of operating within organizational and decisional contexts characterized by high complexity. Over the years, he has helped companies to adopt Artificial Intelligence and Blockchain DLT technologies as strategic tools in protecting sensitive corporate assets. He holds a Master Degree in Economics and Statistics.
Read more about Alessandro Parisi

Right arrow

How to split data into training and test sets

One of the most commonly used methods to evaluate the learning effectiveness of our models is to test the predictions made by the algorithms on data it has never seen before. However, it is not always possible to feed fresh data into our models. One alternative involves subdividing the data at our disposal into training and testing subsets, varying the percentages of data to be assigned to each subset. The percentages usually chosen vary between 70% and 80% for the training subset, with the remaining 20–30% assigned to the testing subset.

The subdivision of the original sample dataset into two subsets for training and testing can be easily performed using the scikit-learn library, as we have done several times in our examples:

from sklearn.model_selection import train_test_split
# Create training and testing subsets
X_train, X_test...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Hands-On Artificial Intelligence for Cybersecurity
Published in: Aug 2019Publisher: PacktISBN-13: 9781789804027

Author (1)

author image
Alessandro Parisi

Alessandro Parisi has been an IT professional for over 20 years, acquiring significant experience as a Security Data Scientist, and as an Artificial Intelligence Cybersecurity and Blockchain specialist. He has experience of operating within organizational and decisional contexts characterized by high complexity. Over the years, he has helped companies to adopt Artificial Intelligence and Blockchain DLT technologies as strategic tools in protecting sensitive corporate assets. He holds a Master Degree in Economics and Statistics.
Read more about Alessandro Parisi