1
$\begingroup$

I have an imbalanced dataset, and using oversampling to make it balanced. I am working on a regression problem. For testing purposes I am applying cross validation on the same dataset for now, using scikit-learn's LassoCV().

However, if I do oversampling before CV, then my model easily overfits since the oversampled items will be distributed over training and testing sets during cross validation. I wonder if there is a way to apply oversampling only on the training set after cross validation makes the split. I prefer to use a scikit-learn method, e.g., cross_val_predict. I wonder if it is possible? Or, do I need to write my own code for this task?

$\endgroup$
  • $\begingroup$ maybe this should have been asked on Stack Overflow. $\endgroup$ – josh Aug 23 '17 at 13:59

Your Answer

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

Browse other questions tagged or ask your own question.