title: Undersampling before or after Train/Test Split
body: <p>I have a credit card dataset with 98% transactions are Non-Fraud and 2% are fraud.</p>
  <p>I have been trying to undersample the majotrity class before train and test split and get very good recall and precision on the test set.</p>
  <p>When I do the undersampling only on training set and test on the independent set I get a very poor precision but the same recall!</p>
  <p>My question is :</p>
  <p>Should I undersample before splitting into train and test , will this mess with the distribution of the dataset and not be representative of the real world?</p>
  <p>Or does the above logic only apply when oversampling?</p>
  <p>Thank you</p>