Upsampling and downsampling in Julia for unbalanced classes

I use Imblearn package in python to do upsampling and downsampling for unbalanced classification problem.

Is there a simple way to accomplish this in Julia?

you can try if this does what you need

https://mldatapatternjl.readthedocs.io/en/latest/documentation/targets.html#under-and-over-sampling

Thanks. Yes this is exactly what I looking for.

You might also find the ClassImbalance.jl package useful. It offers the SMOTE and ROSE algorithms, which are often more effective than simple oversampling and undersampling.

(Disclosure: I am one of the maintainers of ClassImbalance.jl.)

1 Like

How to under sample only the majority class?
For example:
Class 1 has 200.000 points;
Class 2 has 10.000 points;
Class 3 has 5.000 points.

How can I target only Class 1 to have 10.000 points?