Reputation: 428
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!
Upvotes: 7
Views: 17268
Reputation: 1
smote function from mlr package is another good option.
https://www.rdocumentation.org/packages/mlr/versions/2.19.1/topics/smote
Upvotes: 0
Reputation: 129
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
Upvotes: 6
Reputation: 43
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.
Upvotes: 1
Reputation: 417
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
Upvotes: 6