Credit Card Risk Fraud Detection

#frauddetection #credit #debit #card #risk #detection #classification #prediction

Credit card fraud could happen in a variety of terms, such as theft and fraud committed using or involving a payment card, such as debit card or credit card, as a fraudulent source of funds in a transaction. Although credit card incidences occur about 0.1% of all card transactions, it could potentially lead to huge financial losses when the fraudulent transactions are of large monetary value. In 1999, out of 12 billion transactions made annually, approximately 10 million – or one out of every 1200 transactions turned out to be fraudulent [1]. Efforts have taken place to continuously improve credit card fraud detection.

By combining AiSara with an IF statement in excel, it is possible to provide solutions in categorical prediction problem, such as detecting credit card fraud transactions. Let us show you how.


You can get the dataset from Sample.

The dataset was taken from Kaggle and it contains transactions made by credit cards in September 2013 by european cardholders. You can find more information about the dataset here.

This dataset presents transactions that occurred in two days, where we have 302 frauds out of 1280 transactions.

There are numerical input variables which are V1 to V28, and due to confidentiality the variables are named as such. These variables has undergone Principle Component Analysis transformation, which results into numerical values. The other 2 input variables is the time of the transaction, and the transaction amount. On the last column is the output of the dataset, where 1 indicates that this transaction is fraudulent, and 0 otherwise based on the 28 variable inputs.

The test data is placed somewhere convenient in the spreadsheet easily accessible.

Next, we remove 10 rows of data for testing. We took out 5 fraudulent transactions from rows 63 to 67, and 5 non-fraudulent transactions from rows 1586 to 1590. Then we put the data aside, because we will get back to it later. Then we can proceed to using AiSara to learn from the data. What she can do is, she can find patterns between V1 to V28 in relation to whether the transaction is fraudulent or otherwise. Doing so is easy.

Click the Learn button on the top right, and select your input and output. Let Aisara do the learning, and finding the pattern.*

Everything that AiSara learns from the pattern is stored in the anchor cell. For now, we call it “learn cell” to make it easier to understand. The “learn cell” can be called upon to predict the chances for the fraudulent transaction. Here is how.

By using a simple predict() function. Predict(“Learn Cell”, Inputs, Column of output) the results will be displayed in the cell.

AiSara predicts the chances for the first test data to be fraudulent is 0.7713 = 77.13%. To simplify this further, we can use an IF statement in excel, to classify predictions above 50% to be fraud, and less than 50% to be non-fraudulent, or clear from frauds transactions.

Insert IF statement, if AiSara prediction is less than 0.5, then 0, else 1. (where 1 fraud, and 0 is non-fraud)*

This process is repeated with the rest of the 9 rows of test data, which could be done quickly by dragging the cells downward.


AiSara has successfully managed to identify the fraudulent transactions and the non-fraudulent transactions for this dataset. She has managed to see a pattern across 28 variables of over 1200 rows of credit card transaction data, and predict potential fraudulent transactions quickly.

It is also worth mentioning about the the 3rd row of test data. This is an example of 1 fraud case which is almost uncertain for AiSara to predict if it is a credit card fraud or not, since it is close to the 50/50 chance. However out of the 10 rows of data , this is the only one which AiSara is “unsure” about the credit card fraud. You can imagine how AiSara can help with other classification problem such as this one across various industries. It is a tool that can provide valuable insights for the problem at hand. All you need is an excel, and an add-in.


No. A-8-3, Floor 8, Block A,

Megan Avenue 1,

 Jalan Tun Razak,

50400 Kuala Lumpur

  • Twitter
  • Instagram
  • Facebook
  • YouTube
  • LinkedIn