5

I am trying to do SMOTE in R for imbalanced datasets. I tried installing "DMwR" package for this, but it seems this package has been removed from the cran repository. I am getting the error:" package ‘DMwR’ is not available (for R version 4.0.2) "

Can anyone please help me with this? Or suggest any other package to use SMOTE in R?

TIA!

Triparna Poddar
  • 408
  • 1
  • 4
  • 14

3 Answers3

5

You are right. The Error message means that the package is not supported by the newest version of R (4.x.x).

As far as I know the package you are looking for is called "smotefamily" now.

install.packages("smotefamily")

should give you what you need

SEcker
  • 407
  • 2
  • 7
5

smotefamily is an option but the syntax is a bit different than the older syntax used in DMwR. In fact it does not support the classic formula that is used in caret, e.g. target ~ . (see documentation SMOTE(X, target, K = 5, dup_size = 0) https://cran.r-project.org/web/packages/smotefamily/smotefamily.pdf).

Instead the performanceEstimation package has exactly the same formulation of the SMOTE implemented in DMwR:

smote(form, data, perc.over = 2, k = 5, perc.under = 2)

see documentation https://rdrr.io/cran/performanceEstimation/man/smote.html

Serg
  • 121
  • 1
  • 9
1

Big loss with caret for subsambling techniques.

You can find available versions from the archives, download the desired archive and install it as follows:

install.packages("/path/to/archive/DMwR_0.4.1.tar.gz", repos=NULL, type="source")

Personally I can't find an available version for R 4.0.5 (2021-03-31)... I will have to install an older version of R.

Arnaud
  • 43
  • 1
  • 8