October 2018
Intermediate to advanced
172 pages
4h 6m
English
In this subsection, you will learn how to implement your first linear regression algorithm, in order to predict the amount of a mobile transaction by using one input feature: the old balance amount of the account holder. We will be using the same fraudulent mobile transaction dataset that we used in Chapter 2, Predicting Categories with K-Nearest Neighbors, of this book.
The first step is to read in the dataset and define the feature and target variable. This can be done by using the following code:
import pandas as pd#Reading in the datasetdf = pd.read_csv('fraud_prediction.csv')#Define the feature and target arraysfeature = df['oldbalanceOrg'].valuestarget = df['amount'].values
Next, we will create a ...
Read now
Unlock full access