liveBook · Manning

Dataset

As explained in Data-Driven Cybersecurity

A structured collection of data observations and attributes prepared for analysis or computational use.

A dataset is a structured collection of observations and attributes prepared for analysis or computational use. In cybersecurity, datasets turn device activity or login failures into evidence for identifying patterns, anomalies, and decisions. section 11.6 section 13.6.2

Useful cybersecurity datasets connect measurable fields to a specific investigative or operational question:

  • Device activity can include bandwidth usage and access times, supporting comparisons between devices with similar or unusual login behavior. section 11.6
  • Failed-login records can include user ID, login hour, device type, and failure reason, enabling analysis of causes, devices, and time periods. section 13.6.2
  • Interpretation should connect observed patterns to actions such as training, access-control review, device-specific investigation, or peak-hour monitoring. section 13.6.2

Comparing device login behavior

A generated dataset contains five devices with bandwidth-usage and access-time attributes. Applying K-Means groups devices with similar behavior; a server with unusually high bandwidth usage may form a separate cluster and warrant investigation for misuse or abnormal activity. section 11.6

Listing 11.3 Grouping similar events
#Import libraries
from sklearn.cluster import KMeans  #1
import pandas as pd  #2
import matplotlib.pyplot as plt  #3

#Sample dataset: Device login activity
data = {'Device': ['Laptop_A', 'Phone_B', 'Printer_C',
        'Laptop_B', 'Server_D'],  #4
        'Bandwidth_Usage': [100, 200, 50, 90, 300],  #5
        'Access_Times': [10, 12, 3, 9, 16]}  #6

df = pd.DataFrame(data)  #7

#Extract features for clustering
X = df[['Bandwidth_Usage', 'Access_Times']]  #8

#Apply K-means with 2 clusters
kmeans = KMeans(n_clusters=2, random_state=42)  #9
df['Cluster'] = kmeans.fit_predict(X)  #10

#Plot clusters
plt.scatter(df['Bandwidth_Usage'], df['Access_Times'],
            c=df['Cluster'], cmap='viridis', 
 		label='Clusters')  #11
plt.title('K-Means Clustering of Login Activity')  #12
plt.xlabel('Bandwidth Usage')  #13
plt.ylabel('Access Times')  #14
plt.grid(True)  #15
plt.show()  #16

The listing constructs a device-login dataset, extracts bandwidth and access-time features, assigns two K-Means clusters, and plots the results. section 11.6

How Data-Driven Cybersecurity covers it

How deep it goes
Defines datasets through fields and observations, then demonstrates feature extraction, clustering, and reporting.
Examples
Uses five-device login activity with bandwidth and access-time attributes, plus failed-login records grouped by user, hour, device, and reason.
What you can do after
Apply datasets via pandas, scikit-learn, and Matplotlib to cluster device behavior and report failed-login patterns.
How it connects
Links datasets to clustering, anomaly detection, login failures, device behavior, temporal trends, and actionable recommendations.

Also explained in

Compare how 24 books explain dataset →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data-Driven Cybersecurity. The section links point to the parts of the book it draws on.