Skip to content

Commit e4996eb

Browse files
authored
Merge pull request #301 from tidymodels/liquidSVM-changes
liquidSVM changes
2 parents 41693da + a3f6b8c commit e4996eb

File tree

6 files changed

+86
-15
lines changed

6 files changed

+86
-15
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ Suggests:
5050
rpart,
5151
MASS,
5252
nlme,
53-
modeldata
53+
modeldata,
54+
liquidSVM

NEWS.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# parsnip 0.1.1
22

3+
## New Features
4+
5+
* `liquidSVM` was added as an engine for `svm_rbf()` (#300)
6+
7+
## Fixes
8+
9+
* The error message for missing packages was fixed (#289 and #292)
10+
11+
312
## Other Changes
413

514
* S3 dispatch for `tidy()` was broken on R 4.0.
615

7-
* The error message for missing packages was fixed (#289 and #292)
816

917
# parsnip 0.0.5
1018

R/svm_rbf.R

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
#' \item \pkg{R}: `"liquidSVM"`
3737
#' }
3838
#'
39-
#' Note that models created using the `liquidSVM` engine cannot be saved like
40-
#' conventional R objects. The `fit` slot of the `model_fit` object has to be
41-
#' saved separately using the `liquidSVM::write.liquidSVM()` function. Likewise
42-
#' to restore a model, the `fit` slot has to be replaced with the model that is
43-
#' read using the `liquidSVM::read.liquidSVM()` function.
4439
#'
4540
#' @includeRmd man/rmd/svm-rbf.Rmd details
4641
#'

R/svm_rbf_data.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,12 @@ set_pred(
243243
type = "prob",
244244
value = list(
245245
pre = function(x, object) {
246-
if (object$fit$predict.prob == FALSE)
247-
stop("`svm` model does not appear to use class probabilities. Was ",
248-
"the model fit with `predict.prob = TRUE`?", call. = FALSE)
246+
if (!object$fit$predict.prob) {
247+
rlang::abort(
248+
paste0("`svm` model does not appear to use class probabilities. Was ",
249+
"the model fit with `predict.prob = TRUE`?")
250+
)
251+
}
249252
x
250253
},
251254
post = function(result, object) {

man/rmd/svm-rbf.Rmd

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,32 @@ svm_rbf() %>%
1919
translate()
2020
```
2121

22+
## liquidSVM
23+
24+
```{r liquidSVM-reg}
25+
svm_rbf() %>%
26+
set_engine("liquidSVM") %>%
27+
set_mode("regression") %>%
28+
translate()
29+
```
30+
31+
```{r liquidSVM-cls}
32+
svm_rbf() %>%
33+
set_engine("liquidSVM") %>%
34+
set_mode("classification") %>%
35+
translate()
36+
```
37+
38+
Note that models created using the `liquidSVM` engine cannot be saved like
39+
conventional R objects. The `fit` slot of the `model_fit` object has to be saved
40+
separately using the `liquidSVM::write.liquidSVM()` function. Likewise to restore
41+
a model, the `fit` slot has to be replaced with the model that is read using the
42+
`liquidSVM::read.liquidSVM()` function.
43+
44+
`liquidSVM` parameterizes the kernel parameter differently than `kernlab`. To
45+
translate between engines, `sigma = 1/gammas^2`. Users will be specifying
46+
`sigma` and the function translates the value to `gamma`.
47+
2248
## Parameter translations
2349

2450
The standardized parameter names in parsnip can be mapped to their original

man/svm_rbf.Rd

Lines changed: 43 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)