0

Can someone please explain how and what to pass in the weight_column parameter of estimator functions in tensorflow? I want to handle class imbalance problem. For e.g., If I have two class with the following samples:

Class A: #samples = 1000 Class B: #samples = 9000

Now, I am calculating class weights using the following formula:

class weight with label L = Total number of samples in the dataset / (Total Number of samples with label L)

So, I will have:

Class A: weight = 10 Class B: weight = 1.11

Now, I want to know how to use these class weight exactly in tensorflow estimator functions like DNNLinearCombinedClassifier. Some other people have also asked similar questions (Link1 but no one has given a proper answer. The answer by maxim is not complete (Link.

I have tried to initialize the weights as a tf.constant variable but don't know which class will have which labels then.

0 Answers0