Machine Learning for Cybersecurity Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

In the following steps, we utilize scikit-learn's StandardScaler method to standardize our data:

  1. Start by importing the required libraries and gathering a dataset, X:
import pandas as pd

data = pd.read_csv("file_pe_headers.csv", sep=",")
X = data.drop(["Name", "Malware"], axis=1).to_numpy()

Dataset X looks as follows:

  1. Next, standardize X using a StandardScaler instance:
from sklearn.preprocessing import StandardScaler

X_standardized = StandardScaler().fit_transform(X)

The standardized dataset looks like the following: