Let's say I have a dataset from a diabetes hospital which has 30000 Type 2 diabetes and 300 Type 1 diabetes patients.

So this dataset has millions and millions of other data points like lab measurements, drugs prescribed and diagnosis data.

Now my objective is to build a model which can classify Type 2 and Type 1 diabetes patients.

As you can see that the dataset is highly imbalanced and I don't have enough T1DM patients to understand their patterns/behavior/feature which can help me differentiate them from T2DM.

So, my question now is when should I use sampling approaches like oversampling and when should I use GANs?

Should I select features of my interest and then apply oversampling or should I apply GAN?

update (addition to the above scenario)

Let's consider another scenario. I have a dataset which has only 300 T1DM patients (there are no T2DM patients). Now, I would like to just increase my dataset size. Let's also think that I don't have any ML task in my mind (meaing classification/ Regression etc) but I know that 300 samples are very less and can never be used for any meaningful analysis. So, now I would like to increase the dataset size and the use it for analysis. Here, GAN is the only solution for the synthetic data? Since no model is involved, I can't apply oversampling etc. can help me with this?


2 Answers 2


Here are the Options:

  1. Oversampling- sure, there are some possibly good ones like SMOTE etc. Just apply it after Train test split to avoid leakage.

  2. Undersampling - reducing the 30000 to a certain number where what is left is representative of the Information you Need to classify this class. You could, for example, apply some unsupervised learning to see which clusters inside this 30k are available and then only sample from These clusters until you have 300 examples. Or apply other undersampling techniques.

  3. GANS- finally even tough really powerfull in certain Scenarios they are also VERY expensive. I would advise you to try GANS as your final Resort since it will take time for the Network to generate good examples.

CONCLUSION: Maybe you expected a decisive yes or no for GANS, but the truth About it is, its an Experiment. It might work, and it might not. Just like there are situations where NN are terrible.

After update: Theoretically you can apply most of them without any labels, just mark These 300 Points as one label and see what you get. Ofcourse without a clean Goal in mind you could justify any Output as reasonable.

SMOTE has many variants. SMOTE should be treated as a conservative density estimation of the data, which makes the conservative assumption that the line segments between close neighbors of some class belong to the same class. Sampling from this rough, conservative density estimation absolutely makes sense, but does not work necessarily, depending on the distribution of the data.

There are more advanced variants of SMOTE carrying out more proper density estimation. Here is a repo with a lot of smote variations .

Here is also git repo for tabular GANS data Augmentation, this should be easy to consume


GANs do not provide any guarantee on the distribution of the generated data. On the contrary, they are notorious for their mode collapse problems (i.e. generating always the same values). Therefore, I doubt that they are a reliable way of systematically generating synthetic data for other systems to train.

Oversampling techniques like SMOTE are normally much better suited for the likes of your scenario. There are other techniques like providing class weights (see this).

Apart from handling the imbalance, I think the most important aspect here is to use an evaluation measure that behaves well in this scenario and don't lead you to think your model is better than it actually is. Some alternatives for this are the area under the ROC curve (AUC) or the precision-recall AUC.

Update: regarding the updated information in the question, I think that, while knowing what kind of analysis we want to perform is crucial for determining what preprocessing techniques are acceptable, creating artificial data (with GANs or with any other method) would totally ruin any analysis you may want to apply, as you may be altering key aspects like the data distribution.

  • $\begingroup$ I am reading about GAN only today. bear with me if its a basic question So, GAN doesn't generate synthetic data based on sample data distribution (300 samples)? I thought synthetic data generation approaches usually take a sample distribution as input and try to match the fake data as close as possible to the original sample distribution... $\endgroup$
    – The Great
    Commented Nov 2, 2020 at 9:35
  • 1
    $\begingroup$ GANs are precisely known for not being very good at generating diverse data. Research in image GANs has obtained very good results, but these are obtained by carefully tuning the architectures and eyeballing the results to ensure they are Ok. For instance, with face-generating models, you quickly see if the generated faces are all the same or very similar. $\endgroup$
    – noe
    Commented Nov 2, 2020 at 9:50
  • $\begingroup$ By default, vanilla GANs have no built-in mechanism to mimic the dataset distribution. They just learn to generate fake data that can't be distinguished from real data by the discriminator. $\endgroup$
    – noe
    Commented Nov 2, 2020 at 9:52
  • $\begingroup$ Thanks a lot for your help. by this statement generate fake data that can't be distinguished from real data, am I incorrect to understand that they have similar distribution as the original distribution (hence they cannot be distinguished)? $\endgroup$
    – The Great
    Commented Nov 2, 2020 at 10:10
  • $\begingroup$ Let us continue this discussion in chat. $\endgroup$
    – noe
    Commented Nov 2, 2020 at 10:13

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.