title: Class weights in CNN
body: <p>I have a very unbalanced dataset. First, I divided this dataset into a training dataset(80%) and a validation dataset(20%). I used the <code>StratifiedShuffleSplit</code> so both datasets preserve each class percentage.</p>
  <p>To tackle the fact that both datasets are unbalanced I am using the <code>class_weight</code>. This is the code I use for that:</p>
  <pre><code>class_weight = {0: 70.,
                  1: 110.,
                  2: 82.,
                  3: 17.,
                  4: 9.}
  
  
  model.fit(train_generator, epochs = 5, class_weight=(class_weight), validation_data=(x_val, y_val))  
  </code></pre>
  <p>The variable <code>class_weight</code> currently has the number of images of each class of the whole dataset, that is, the combination of training and validation datasets. Should it be done like that? Or should it have the images of the training dataset?</p>
  <p>I have another question. Supposing I do data augmentation how can I know for sure the number of images per class? Is there an automatic calculator or something of sorts?</p>