Fraud Detection using Isolation Forest

Patrizia Castagno
6 min readFeb 9, 2024

In this section, we will see an example of Isolation Forest. We will focus on the following algorithm to obtain information about fraud cases in financial transactions. The data source can be found here

Initially, we should load the data and import the necessary library for this initial step.

Load the Dataset:

#Load the data
import pandas as pd

data = pd.read_excel('data.xlsx')
data

Output:

Imagen by the Author

Each data attribute is described as follows:

  • step: signifies a unit of time in the real world. Here, 1 step corresponds to 1 hour of time.
  • type: transaction category, which may include CASH-IN (deposit), CASH-OUT (withdrawal), DEBIT, PAYMENT, or TRANSFER.
  • amount: transaction value in the local currency.
  • nameOrig: initiator of the transaction.
  • oldbalanceOrg: initial balance before the transaction for the initiator.
  • newbalanceOrig: post-transaction balance for the initiator.
  • nameDest: recipient of the transaction.
  • oldbalanceDest: initial balance for the recipient.
  • newbalanceDest: post-transaction balance for the recipient.

--

--

Patrizia Castagno

Physics and Data Science.Eagerly share insights and learn collaboratively in this growth-focused space.LinkedIn:www.linkedin.com/in/patrizia-castagno-diserafino