This question already has an answer here:

I am trying to do binary classification of News Articles (Sports/Non-Sports) using recurrent neural net in tensorflow. The training data is highly skewed [Sports:Non-Sports::1:9].

I am using cross-entropy as my cost function, which treats both classes equally.

What are the ways by which user can penalise one class? Or is there any other cost function suitable for this purpose?


marked as duplicate by kjetil b halvorsen, mdewey, Peter Flom Feb 27 '17 at 12:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Hugh is right, this is not a problem inherent to deep learning but is something that comes across multiple datasets and techniques to classify them. As mentioned in the links provided by Hugh there are myriads of techniques to deal with them.

"What are the ways by which user can penalize one class" - You can use cost sensitive training where basically you assign a higher cost if your classifier miss-classifies the minority class, Sports in your case.

You can also look into Boosting based techniques as they do a similar thing.

This paper compares various such techniques.


Not the answer you're looking for? Browse other questions tagged or ask your own question.