简体   繁体   中英

“All zero class” prediction by Neural Network

In a classification problem involving the identification of fraudulent transactions, I reduced the dimensionality of the data(28 columns)[A complete quasi-separation was detected by Logit in statsmodels] using a stacked auto encoder(28->15->5) and fed the compressed data(5 columns) into a neural network with two hidden layers, each having 10 nodes and 'relu' activation function. I trained the model over a 100 epochs(The AUC metric didn't go beyond 0.500 and the train loss became constant after a few epochs).The model predicted all the records of the test set as non-fraudulent(0 class) and yielded a confusion matrix like this:

Confusion matrix: [[70999 0] [ 115 0]] Accuracy Score: 0.9983828781955733

Can someone please explain the problem behind this result and suggest a feasible solution?..

Since your accuracy is over 99% on all zero class prediction, the percent of fraud cases in your train set is less than 1%

Typically if the fraud cases are rare, the model will not place enough importance on the fraud cases to predict well.

to fix this you can add costs to penalize the majority class, or add weights to penalize the majority class or use class balancing methods such as SMOTE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM