I'm looking for the best sampling method for classification modeling (logistic regression OR Xgboost ) that will decrease the number of observations in the training data set while keeping the bias and variance as low as possible. Is there any function or rule of thumb that I can use in order to get to this goal ? I currently use this method (code in R) but I'm not sure that it the best for both algorithms (logistic regression OR Xgboost ):

prb <- ifelse(df_train$TargetVar=='1',1,0.5)
smpl <- df_train[sample(nrow(df_train), as.numeric(nrow(df_train) * 0.2) , prob = prb),]

1 Answer 1


a possible approach is testing several models based on different set-ups. Each set-up corresponds to a single sampling plan. This can be useful when dealing with unbalanced classes in the dependant variable.

The lines of code you used can fit both logistic model and gradient boosting, but it fits only the "downsampling" case. If you don't have enough units in your population, you will have to "resample" the rare class in order to improve results.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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