For my Credit card fraud detection (classification) project I have got two data set, Train.csv and Test.csv When I checked the summary of the dataset I found my target variable, "is_fraud" is highly imbalanced. 99.2% data is not_fraud and only 0.71% is fraud as shown below. How can I balance the this data.
0: 12875 -> 99.29%
1: 91 -> 0.71%
In test.csv also same thing, 99% data is "not_fraud" and 1% data is "fraud".
So, I have 2 questions
Q1) Do I need to balance both train and test, or only train.
Q2) How to balance them.
Any help will be appreciated. I am using R programming for this project.
How to balance the data in target variable.