How to do it...

In the following steps, you will convert the featurized data into a collection of time series and detect crime using isolation forest:

  1. List all threat actors in preparation for creating labels:
threat_actors = [    "AAM0658",    "AJR0932",    "BDV0168",    <snip>    "MSO0222",]
  1. We then index the dates:
start_date = joint["date"].iloc[0]end_date = joint["date"].iloc[-1]time_horizon = (end_date - start_date).days + 1def date_to_index(date):    """Indexes dates by counting the number of days since the starting date of the dataset."""    return (date - start_date).days
  1. Define a function to extract the time series information of a given user:
def extract_time_series_by_user(user_name, df): """Filters the dataframe down to a specific user.""" ...

Get Machine Learning for Cybersecurity Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.