Skip to content

Commit

Permalink
fixes for archived DMwR for #1226
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Sep 20, 2021
1 parent f42fa5d commit 10ee56f
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 53 deletions.
6 changes: 3 additions & 3 deletions models/sampling_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ sampling_methods <- list(
up = function(x, y)
upSample(x, y, list = TRUE),
smote = function(x, y) {
checkInstall("DMwR")
library(DMwR)
checkInstall("themis")
library(themis)
dat <-
if (is.data.frame(x)) {
if (inherits(x, "tbl_df"))
Expand All @@ -16,7 +16,7 @@ sampling_methods <- list(
else
as.data.frame(x)
dat$.y <- y
dat <- SMOTE(.y ~ ., data = dat)
dat <- themis::smote(dat, var = ".y")
list(x = dat[,!grepl(".y", colnames(dat), fixed = TRUE), drop = FALSE],
y = dat$.y)
},
Expand Down
113 changes: 74 additions & 39 deletions pkg/caret/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,81 +1,116 @@
Package: caret
Version: 6.0-88
Title: Classification and Regression Training
Authors@R: c(
person("Max", "Kuhn", role = c("aut", "cre"), email = "mxkuhn@gmail.com"),
person("Jed", "Wing", role = "ctb"),
person("Steve", "Weston", role = "ctb"),
person("Andre", "Williams", role = "ctb"),
person("Chris", "Keefer", role = "ctb"),
person("Allan", "Engelhardt", role = "ctb"),
person("Tony", "Cooper", role = "ctb"),
person("Zachary", "Mayer", role = "ctb"),
person("Brenton", "Kenkel", role = "ctb"),
person("R Core Team", role = "ctb"),
person("Michael", "Benesty", role = "ctb"),
person("Reynald", "Lescarbeau", role = "ctb"),
person("Andrew", "Ziem", role = "ctb"),
person("Luca", "Scrucca", role = "ctb"),
person("Yuan", "Tang", role = "ctb"),
person("Can", "Candan", role = "ctb"),
person("Tyler", "Hunt", role = "ctb")
)
Version: 6.0-88
Authors@R:
c(person(given = "Max",
family = "Kuhn",
role = c("aut", "cre"),
email = "mxkuhn@gmail.com"),
person(given = "Jed",
family = "Wing",
role = "ctb"),
person(given = "Steve",
family = "Weston",
role = "ctb"),
person(given = "Andre",
family = "Williams",
role = "ctb"),
person(given = "Chris",
family = "Keefer",
role = "ctb"),
person(given = "Allan",
family = "Engelhardt",
role = "ctb"),
person(given = "Tony",
family = "Cooper",
role = "ctb"),
person(given = "Zachary",
family = "Mayer",
role = "ctb"),
person(given = "Brenton",
family = "Kenkel",
role = "ctb"),
person(given = "R Core Team",
role = "ctb"),
person(given = "Michael",
family = "Benesty",
role = "ctb"),
person(given = "Reynald",
family = "Lescarbeau",
role = "ctb"),
person(given = "Andrew",
family = "Ziem",
role = "ctb"),
person(given = "Luca",
family = "Scrucca",
role = "ctb"),
person(given = "Yuan",
family = "Tang",
role = "ctb"),
person(given = "Can",
family = "Candan",
role = "ctb"),
person(given = "Tyler",
family = "Hunt",
role = "ctb"))
Description: Misc functions for training and plotting classification and
regression models.
Depends:
R (>= 3.2.0),
lattice (>= 0.20),
ggplot2
License: GPL (>= 2)
URL: https://github.com/topepo/caret/
BugReports: https://github.com/topepo/caret/issues
Depends:
ggplot2,
lattice (>= 0.20),
R (>= 3.2.0)
Imports:
foreach,
grDevices,
methods,
plyr,
ModelMetrics (>= 1.2.2.2),
nlme,
plyr,
pROC,
recipes (>= 0.1.10),
reshape2,
stats,
stats4,
utils,
grDevices,
recipes (>= 0.1.10),
withr (>= 2.0.0),
pROC,
withr (>= 2.0.0)
Suggests:
BradleyTerry2,
covr,
Cubist,
dplyr,
e1071,
earth (>= 2.2-3),
ellipse,
fastICA,
gam (>= 1.15),
ipred,
kernlab,
knitr,
klaR,
knitr,
MASS,
ellipse,
Matrix,
mda,
mgcv,
mlbench,
MLmetrics,
nnet,
pamr,
party (>= 0.9-99992),
pls,
proxy,
randomForest,
RANN,
rmarkdown,
rpart,
spls,
subselect,
pamr,
superpc,
Cubist,
testthat (>= 0.9.1),
rpart,
dplyr,
covr
License: GPL (>= 2)
RoxygenNote: 7.1.1.9001
VignetteBuilder: knitr
themis (>= 0.1.3)
VignetteBuilder:
knitr
Encoding: UTF-8
RoxygenNote: 7.1.2
2 changes: 1 addition & 1 deletion pkg/caret/R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ parse_sampling <- function(x, check_install = TRUE) {
func = sampling_methods[x][[1]],
first = TRUE)
}
pkgs <- switch(x$name, rose = "ROSE", smote = "DMwR", "")
pkgs <- switch(x$name, rose = "ROSE", smote = "themis", "")
if(pkgs != "" & check_install)
checkInstall(pkgs)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/caret/R/trainControl.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
#' sampling that is conducted after resampling (usually to resolve class
#' imbalances). Values are \code{"none"}, \code{"down"}, \code{"up"},
#' \code{"smote"}, or \code{"rose"}. The latter two values require the
#' \pkg{DMwR} and \pkg{ROSE} packages, respectively. This argument can also be
#' \pkg{themis} and \pkg{ROSE} packages, respectively. This argument can also be
#' a list to facilitate custom sampling and these details can be found on the
#' \pkg{caret} package website for sampling (link below).
#' @param index a list with elements for each resampling iteration. Each list
Expand Down
9 changes: 9 additions & 0 deletions pkg/caret/inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
\newcommand{\cpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}}
\newcommand{\issue}{\href{https://github.com/topepo/caret/issues/#1}{(issue #1)}}


\section{Changes in version 6.0-89}{
\itemize{
\item SMOTE subsampling is now computed via the \cpkg{themis} package \issue{1226}.

}
}


\section{Changes in version 6.0-88}{
\itemize{
\item Fixed cases where the "corr" filter was not run in \code{preProcess()}.
Expand Down
4 changes: 2 additions & 2 deletions pkg/caret/man/createDataPartition.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/caret/man/recall.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/caret/man/sensitivity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/caret/man/trainControl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 10ee56f

Please sign in to comment.