Byron Rogers
Byron Rogers

Reputation: 73

Weigh a image within the positive class

I have a set of ~35,000 images that I am training a CNN on in Tensorflow.

~5% of the images are the positive class, 95% the negative class.

Within the positive class, there are some images that are "more positive" and some that are "less positive" if that makes sense.

I was wondering if it were possible to assign a weight to these "more positive" samples within the positive class (in addition to having to oversample this class in general) so that these images were considered more important.

Any ideas, or is this just not possible?

Upvotes: 2

Views: 58

Answers (1)

chasep255
chasep255

Reputation: 12175

You could just multiply the cost function by whatever weight you decide to use for the positive and more positive classes. Right now I am working on a network where 1/3 is positive and 2/3 are negative. However I make sure that statistically the batches are split 50/50 between the classes. I just end up repeating some of my positive class throughout the epoch.

If some classes are more positive than others maybe you should have more than two classes. Like Negative, Neutral, Sort of Positive, and Positive.

Upvotes: 1

Related Questions