Skip to content

Commit 6b8ad19

Browse files
committed
more changes for non-standard arguments for #315
1 parent 376af2c commit 6b8ad19

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
* `tidyr` >= 1.0.0 is now required.
66

7+
* SVM models produced by `kernlab` now use the formula method. This change was due to how `ksvm()` made indicator variables for factor predictors (with one-hot encodings). Since the ordinary formula method did not do this, the data are passed as-is to `ksvm()` so that the results are closer to what one would get if `ksmv()` were called directly.
8+
9+
* MARS models produced by `earth` now use the formula method.
10+
11+
* Under-the-hood changes were made so that non-standard data arguments in the modeling packages can be accomodated. (#315)
12+
713
## New Features
814

915
* A new main argument was added to `boost_tree()` called `stop_iter` for early stopping. The `xgb_train()` function gained arguments for early stopping and a percentage of data to leave out for a validation set.

R/arguments.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ make_form_call <- function(object, env = NULL) {
158158

159159
# add data arguments
160160
for (i in seq_along(data_args)) {
161-
fit_args[[ names(data_args)[i] ]] <- sym(unname(data_args[i]))
161+
fit_args[[ unname(data_args[i]) ]] <- sym(names(data_args)[i])
162162
}
163163

164164
# sub in actual formula
165-
fit_args[[ data_args["formula"] ]] <- env$formula
165+
fit_args[[ unname(data_args["formula"]) ]] <- env$formula
166166

167167
if (object$engine == "spark") {
168168
env$x <- env$data
@@ -186,8 +186,8 @@ make_xy_call <- function(object, target) {
186186
data_args <- object$method$fit$data
187187
}
188188

189-
object$method$fit$args[[ data_args["y"] ]] <- rlang::expr(y)
190-
object$method$fit$args[[ data_args["x"] ]] <-
189+
object$method$fit$args[[ unname(data_args["y"]) ]] <- rlang::expr(y)
190+
object$method$fit$args[[ unname(data_args["x"]) ]] <-
191191
switch(
192192
target,
193193
none = rlang::expr(x),

0 commit comments

Comments
 (0)