I am using Credit card data for oversampling using SMOTE. I am using the code written in geeksforgeeks.org (Link)
After running the following code, it states something like that:
print("Before OverSampling, counts of label '1': {}".format(sum(y_train == 1)))
print("Before OverSampling, counts of label '0': {} \n".format(sum(y_train == 0)))
# import SMOTE module from imblearn library
# pip install imblearn (if you don't have imblearn in your system)
from imblearn.over_sampling import SMOTE
sm = SMOTE(random_state = 2)
X_train_res, y_train_res = sm.fit_sample(X_train, y_train.ravel())
print('After OverSampling, the shape of train_X: {}'.format(X_train_res.shape))
print('After OverSampling, the shape of train_y: {} \n'.format(y_train_res.shape))
print("After OverSampling, counts of label '1': {}".format(sum(y_train_res == 1)))
print("After OverSampling, counts of label '0': {}".format(sum(y_train_res == 0)))
Output:
Before OverSampling, counts of label '1': 345
Before OverSampling, counts of label '0': 199019
After OverSampling, the shape of train_X: (398038, 29)
After OverSampling, the shape of train_y: (398038,)
After OverSampling, counts of label '1': 199019
After OverSampling, counts of label '0': 199019
As I am totally new in this area. I cant understand how to show these data in CSV format. I will be very glad if anyone help me regarding this issue.
Or if there is any reference from where I can make synthetic data from a dataset using SMOTE and save the updated dataset in a CSV file, please mention it.
Something like following image:
Thanks in advance.