In order to evaluate the performance of classification, let's consider the two classification algorithms that we have built in this book: k-nearest neighbors and logistic regression.
The first step will be to implement both of these algorithms in the fraud detection dataset. We can do this by using the following code:
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn import linear_model
#Reading in the fraud detection dataset
df = pd.read_csv('fraud_prediction.csv')
#Creating the features
features = df.drop('isFraud', axis = 1).values
target = df['isFraud'].values
#Splitting the data into training and test sets
X_train, X_test, y_train, y_test = train_test_split(features, target, test_size = 0.3, random_state ...