# Classifying on imbalanced dataset

I have incidents VS normal operation of my working environment. It is a skew dataset. My prediction accuracy is 95%.

Question:
1. Is it common practice among data scientist to accept this prediction?
2. Do I have to rework by resample and balance the skewness and train & test again?

I am sorry to ask for partial opinion based question.

Regarding the second question, I would suggest to use a weighted loss function, where mistakes on the rarer classes have a higher price (it encourages the model to classify them correctly). For optimal performance, you should retrain your model from scratch.

Note for future reference, it is better to present the results in a confusion matrix, than just the final classification (gives more data, especially when we talk about a skewed dataset).

• Thank you very much for terms weighted loss function and confusion matrix.
– ii2
Dec 27 '18 at 5:23
1. There are a lot of imbalanced datasets such as cancer and anomaly detection datasets. I can say that it is very normal that we work with imbalanced datasets.
2. If skewness of dataset is high, you can try to increase the number of samples with few data. Or you may consider the weighted loss function to improve the performance of the prediction model.

Yes. I agree this is a subjective question. Based on the histogram, you have 16500 samples of class 8 and 500 of other classes. The class representation is around 97% and 3%. This is severe imbalance. So without any model, it is safe to always blindly predict the output as class 8. This gives me around 96% - 97% accuracy based on random sampling.

Now getting an accuracy of 95% using ML model doesnt give additional confidence. What is happening is the model got trained looking at class 8 samples most of the time and it will blindly predict class 8 as outcome.

You need to definitely follow undersampling of class 8 or oversampling of other classes (SMOTE).