October 2018
Intermediate to advanced
172 pages
4h 6m
English
The first step to building any machine learning model with scikit-learn is to split the data into training and test sets. This can be done by using the following code:
from sklearn.model_selection import train_test_split#Creating the features and targetfeatures = df.drop('isFraud', axis = 1).valuestarget = df['isFraud'].values#Creating the training and testing dataX_train, X_test, y_train, y_test = train_test_split(features, target, test_size = 0.3, random_state = 42, stratify = target)
The next step is to implement a base logistic regression classifier and evaluate its accuracy score. This can be done by using the following code:
from sklearn import linear_model#Initializing an logistic regression ...
Read now
Unlock full access