1
$\begingroup$

I am doing multilabel news classification in python language.The dataset I have has two files. First CSV contains articles at each row. Second CSV contains corresponding labels to each article. Here is the snapshot of label file

enter image description here

Here is the dropbox link....https://www.dropbox.com/s/7huzh41je735oqn/labelset.csv?dl=0

  1. Is the dataset imbalanced one?
  2. How do I distribute this dataset properly into training set, validation and test set?

Note: By properly I mean, Can this unbalanced dataset be split into proper proportions in training,validation and testing set?

$\endgroup$
4
  • $\begingroup$ What models are you working with? $\endgroup$
    – Leevo
    Commented Jun 12, 2019 at 22:21
  • $\begingroup$ Sorry I did not understand your question....I am working with keras right now. Is that what you are asking? $\endgroup$
    – Pratik.S
    Commented Jun 12, 2019 at 22:35
  • 1
    $\begingroup$ Ok, so you are working with Neural Networks. $\endgroup$
    – Leevo
    Commented Jun 13, 2019 at 7:04
  • $\begingroup$ Now I understand what you mean.....:D $\endgroup$
    – Pratik.S
    Commented Jun 13, 2019 at 10:05

2 Answers 2

2
$\begingroup$

I'll go through your questions one by one:

Is the dataset imbalanced one?

The distinction between a balanced and an imbalanced dataset is a matter of degree. If you think that the difference in number of observations for each class is too big, I suggest you to train your model using Mini-Batch Gradient Descent, and build any mini batch in a way that observations have the same frequency. This would attribute greater weights to the less frequent observations.

How do I distribute this dataset properly into training set, validation and test set?

Make sure that all the classes are evenly distributed among the sets.

$\endgroup$
2
  • $\begingroup$ Have you used skmultilearn.model's iterative sampling function in Python? Can I use it to split the dataset into training and testing?Here is the documentation.... scikit.ml/stratification.html $\endgroup$
    – Pratik.S
    Commented Jun 13, 2019 at 10:12
  • 1
    $\begingroup$ Sorry, I'm not familiar with that tool. I usually use custom training to implement mini batch GD. You can check my Notebook and modify the code if you think it's useful: github.com/IvanBongiorni/TensorFlow2.0_Tutorial/blob/master/… $\endgroup$
    – Leevo
    Commented Jun 13, 2019 at 10:49
1
$\begingroup$

Yes, the dataset you have been working with is an imbalanced dataset but this problem could easily be tackled if rather than predicting the outcome directly, you will tackle this problem by top 3 predictions. Over the top 3 predictions, you can also add one more check for the threshold to validate the predictions and finalize the prediction.

Apart from this, I would suggest you to manually split the dataset into training and validation set in order to maintain a consistency in the data and help tackle co-variate shift problem.

$\endgroup$
4
  • $\begingroup$ You mean I need to see the results for only top 3 predictions and validate it? $\endgroup$
    – Pratik.S
    Commented Jun 13, 2019 at 10:05
  • $\begingroup$ Yes, this should solve the problem. $\endgroup$
    – thanatoz
    Commented Jun 13, 2019 at 10:20
  • $\begingroup$ I am confused....By top 3 predictions what do you mean? $\endgroup$
    – Pratik.S
    Commented Jun 13, 2019 at 11:50
  • $\begingroup$ By top 3 predictions I mean the classes predicted with top confidences. The confidence of each prediction can be obtained by applying the softmax layer in the last layer. $\endgroup$
    – thanatoz
    Commented Jun 13, 2019 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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