Case Studies - Stout

Welcome. This is the webpage containing my answers to the case studies.

Feel free to check out my website for a more detailed profile!

Customer Orders

Below is a table containing the desired metrics (scrollable).

Current YearPrevious YearTotal Customers Current YearTotal Customers Previous YearNew CustomersLost CustomersExisting CustomersExisting Customer Revenue Current YearExisting Customer Revenue Previous YearExisting Customer Revenue GrowthRevenue Lost From AttritionTotal Revenue Current YearNew Customer Revenue
20152014231,2940231,29400000029,036,749.1929,036,749.19
20162015204,646231,294136,891163,53967,7558,524,576.698,485,533.0439,043.720,551,216.1525,730,943.5917,206,366.90
20172016249,987204,646173,449128,10876,5389,648,282.029,584,424.9663,857.116,146,518.6331,417,495.0321,769,213.01

Note:

For the current year of 2015, existing customers and their revenue from the previous year was assumed to be zero. Additionally, revenue lost from attrition was interpreted to be total revenue from previous year from customers lost (no longer in current year).

Fraud Detection

The dataset has about 6.3 million rows and 11 columns where each row represents a transaction. Column descriptions are available on kaggle. Also, there are no nulls in the table. For the transaction type, cash withdrawals and payment transactions are the most common, while transfers and debits make up a smaller fraction of the data.

Here it can be seen that oldbalance* and newbalance* are highly correlated with each other since transaction amounts are typically a small proportion of account balances i.e, account balances have high correlations with themselves.

The dataset is highly imbalanced. Over 99.8% of the transaction records are non-fraudulent. Because only a tiny fraction of the dataset represents fraud, fraudulent transactions are likely to be under-represented in the models. To counter this, proper scaling of samples will take place.

Below, the plots between amount and oldbalanceOrig can be seen. It can be concluded that amounts are skewed right—the vast majority of transactions are low amounts.

Lastly, there appears to be a weak positive relationship between amounts and destination account balances, which was observed earlier in the correlation matrix.

Logistic Regression approach

For this analysis only the row data TRANSFER and CASH_OUT types were retained. There was a 30/70 split between test/train sets. The y_score was found to be 0.9197251695947122 and precision score was 0.9740788254011161

The closer the ROC curve is to the upper left corner, it means that more positive samples are predicted to be 1, and more negative samples are not predicted to be 1.

XGBoost (Gradient Boosting) approach

The XGBoost classifier was used to train the 20/80 train/test split data. Further, Error columns for Origin and Destination were added to normalize values. The accuracy was found to be 0.9999530726256983 and F1 macro score was 0.9937862376528303. Shown below is the corresponding decision tree generated.

Nalin Gadihoke
Nalin Gadihoke
💻 | ⚛