<jupyter_start><jupyter_text>It is not a good practice to build machine learning models where the labels are encoded as negative values. It affects the performance of the models. So, you would want to change the -1 values to 0.<jupyter_code># Rebase the values
data.rename(columns={"Result": "Class"}, inplace=True)

data["Class"] = data["Class"].map({-1:0, 1:1})
data["Class"].unique()<jupyter_output><empty_output><jupyter_text>We can look for missing values in the dataset like so -<jupyter_code>data.isna().sum()<jupyter_output><empty_output><jupyter_text>As I had mentioned that missing values can be present in a lot of various forms. Refer to the article I mentioned in the previous task's solution to know more about this. Let's now split the dataset in a 80:20 ratio.<jupyter_code>from sklearn.model_selection import train_test_split
X = data.iloc[:,0:30].values.astype(int)
y = data.iloc[:,30].values.astype(int)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=np.random.seed(7))<jupyter_output><empty_output><jupyter_text>Let's serialize the splits as well. Remember that our splits are now nothing but `numpy` arrays and those can be easily serialized like the following.<jupyter_code># Serialize the numpy arrays
np.save("X_train.npy", X_train), np.save("y_train.npy", y_train)
np.save("X_test.npy", X_train), np.save("y_test.npy", y_train)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1160337552742616, 'fraction_numerical': 0.012658227848101266, 'mean_word_length': 6.529100529100529, 'pattern_counts': {'":': 1, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '87574', 'license': 'MIT', 'n_tokens_mistral': 484, 'n_tokens_neox': 474, 'n_words': 149, 'path': 'Manning/Phishing_Websites_Detection/notebooks/.ipynb_checkpoints/3. Cleaning the class labels and inspecting for missing values-checkpoint.ipynb', 'repo_name': 'lalitsurampudi/Machine-Learning', 'size': '1422'}