Skip to content

Commit 52d9f77

Browse files
authored
Merge pull request #230 from tidymodels/control-parsnip
new control function name
2 parents 976567f + 7208825 commit 52d9f77

File tree

126 files changed

+1750
-1529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+1750
-1529
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: parsnip
2-
Version: 0.0.3.9002
2+
Version: 0.0.4
33
Title: A Common API to Modeling and Analysis Functions
44
Description: A common interface is provided to allow users to specify a model without having to remember the different argument names across different functions or computational engines (e.g. 'R', 'Spark', 'Stan', etc).
55
Authors@R: c(

NAMESPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ S3method(predict_raw,"_elnet")
3232
S3method(predict_raw,"_lognet")
3333
S3method(predict_raw,"_multnet")
3434
S3method(print,boost_tree)
35+
S3method(print,control_parsnip)
3536
S3method(print,decision_tree)
36-
S3method(print,fit_control)
3737
S3method(print,linear_reg)
3838
S3method(print,logistic_reg)
3939
S3method(print,mars)
@@ -90,6 +90,7 @@ export(C5.0_train)
9090
export(add_rowindex)
9191
export(boost_tree)
9292
export(check_empty_ellipse)
93+
export(control_parsnip)
9394
export(decision_tree)
9495
export(fit)
9596
export(fit.model_spec)

NEWS.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
# parsnip 0.0.3.9001
1+
# parsnip 0.0.4
22

33
## New Features
44

5-
* The time elapsed during model fitting is stored in the `$elapsed` slot of the
6-
parsnip model object, and is printed when the model object is printed.
5+
* The time elapsed during model fitting is stored in the `$elapsed` slot of the parsnip model object, and is printed when the model object is printed.
76

87
* Some default parameter ranges were updated for SVM, KNN, and MARS models.
98

9+
* The model `udpate()` methods gained a `parameters` argument for cases when the parameters are contained in a tibble or list.
10+
11+
* `fit_control()` is soft-deprecated in favor of `control_parsnip()`.
12+
1013
## Fixes
11-
* [A bug](https://github.com/tidymodels/parsnip/issues/222) was fixed standardizing
12-
the output column types of `multi_predict` and `predict` for `multinom_reg`.
14+
15+
* [A bug](https://github.com/tidymodels/parsnip/issues/222) was fixed standardizing the output column types of `multi_predict` and `predict` for `multinom_reg`.
1316

1417
* [A bug](https://github.com/tidymodels/parsnip/issues/208) was fixed related to using data descriptors and `fit_xy()`.
1518

1619
* A bug was fixed related to the column names generated by `multi_predict()`. The top-level tibble will always have a column named `.pred` and this list column contains tibbles across sub-models. The column names for these sub-model tibbles will have names consistent with `predict()` (which was previously incorrect). See [43c15db](https://github.com/tidymodels/parsnip/commit/43c15db377ea9ef27483ff209f6bd0e98cb830d2).
1720

18-
* The model `udpate()` methods gained a `parameters` argument for cases when the parameters are contained in a tibble or list.
19-
2021
* [A bug](https://github.com/tidymodels/parsnip/issues/174) was fixed standardizing the column names of `nnet` class probability predictions.
2122

2223

R/boost_tree.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
#' reloaded and reattached to the `parsnip` object.
100100
#'
101101
#' @importFrom purrr map_lgl
102-
#' @seealso [varying()], [fit()], [set_engine()]
102+
#' @seealso [[fit()], [set_engine()]
103103
#' @examples
104104
#' boost_tree(mode = "classification", trees = 20)
105105
#' # Parameters can be represented by a placeholder:

R/fit_control.R renamed to R/control_parsnip.R

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,25 @@
1616
#' class "try-error".
1717
#' @return An S3 object with class "fit_control" that is a named list with the
1818
#' results of the function call
19+
#' @details
20+
#' `fit_control()` is deprecated in favor of `control_parsnip()`.
1921
#' @export
2022
#'
21-
22-
fit_control <- function(verbosity = 1L, catch = FALSE) {
23+
control_parsnip <- function(verbosity = 1L, catch = FALSE) {
2324
res <- list(verbosity = verbosity, catch = catch)
2425
res <- check_control(res)
25-
class(res) <- "fit_control"
26+
class(res) <- "control_parsnip"
2627
res
2728
}
2829

2930
#' @export
30-
print.fit_control <- function(x, ...) {
31+
#' @rdname control_parsnip
32+
fit_control <- function(verbosity = 1L, catch = FALSE) {
33+
control_parsnip(verbosity = verbosity, catch = catch)
34+
}
35+
36+
#' @export
37+
print.control_parsnip <- function(x, ...) {
3138
cat("parsnip control object\n")
3239
if (x$verbosity > 1)
3340
cat(" - verbose level", x$verbosity, "\n")

R/decision_tree.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
#' reloaded and reattached to the `parsnip` object.
8585
#'
8686
#' @importFrom purrr map_lgl
87-
#' @seealso [varying()], [fit()]
87+
#' @seealso [[fit()]
8888
#' @examples
8989
#' decision_tree(mode = "classification", tree_depth = 5)
9090
#' # Parameters can be represented by a placeholder:

R/fit.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#' outcome(s), predictors, case weights, etc). Note: when needed, a
2020
#' \emph{named argument} should be used.
2121
#' @param control A named list with elements `verbosity` and
22-
#' `catch`. See [fit_control()].
22+
#' `catch`. See [control_parsnip()].
2323
#' @param ... Not currently used; values passed here will be
2424
#' ignored. Other options required to fit the model should be
2525
#' passed using `set_engine()`.
@@ -42,7 +42,7 @@
4242
#'
4343
#' If the model engine has not been set, the model's default engine will be used
4444
#' (as discussed on each model page). If the `verbosity` option of
45-
#' [fit_control()] is greater than zero, a warning will be produced.
45+
#' [control_parsnip()] is greater than zero, a warning will be produced.
4646
#' @examples
4747
#' # Although `glm()` only has a formula interface, different
4848
#' # methods for specifying the model can be used
@@ -81,7 +81,7 @@
8181
#' The return value will also have a class related to the fitted model (e.g.
8282
#' `"_glm"`) before the base class of `"model_fit"`.
8383
#'
84-
#' @seealso [set_engine()], [fit_control()], `model_spec`, `model_fit`
84+
#' @seealso [set_engine()], [control_parsnip()], `model_spec`, `model_fit`
8585
#' @param x A matrix or data frame of predictors.
8686
#' @param y A vector, matrix or data frame of outcome data.
8787
#' @rdname fit
@@ -91,7 +91,7 @@ fit.model_spec <-
9191
function(object,
9292
formula = NULL,
9393
data = NULL,
94-
control = fit_control(),
94+
control = control_parsnip(),
9595
...
9696
) {
9797
if (object$mode == "unknown") {
@@ -182,7 +182,7 @@ fit_xy.model_spec <-
182182
function(object,
183183
x = NULL,
184184
y = NULL,
185-
control = fit_control(),
185+
control = control_parsnip(),
186186
...
187187
) {
188188
object <- check_mode(object, levels(y))

R/linear_reg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
#' separately saved to disk. In a new session, the object can be
9999
#' reloaded and reattached to the `parsnip` object.
100100
#'
101-
#' @seealso [varying()], [fit()], [set_engine()]
101+
#' @seealso [[fit()], [set_engine()]
102102
#' @examples
103103
#' linear_reg()
104104
#' # Parameters can be represented by a placeholder:

R/logistic_reg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
#' separately saved to disk. In a new session, the object can be
9898
#' reloaded and reattached to the `parsnip` object.
9999
#'
100-
#' @seealso [varying()], [fit()]
100+
#' @seealso [[fit()]
101101
#' @examples
102102
#' logistic_reg()
103103
#' # Parameters can be represented by a placeholder:

R/mars.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#' attached.
5656
#'
5757
#' @importFrom purrr map_lgl
58-
#' @seealso [varying()], [fit()]
58+
#' @seealso [[fit()]
5959
#' @examples
6060
#' mars(mode = "regression", num_terms = 5)
6161
#' @export

R/mlp.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
#' \Sexpr[results=rd]{parsnip:::show_fit(parsnip:::mlp(mode = "regression"), "nnet")}
7878
#'
7979
#' @importFrom purrr map_lgl
80-
#' @seealso [varying()], [fit()]
80+
#' @seealso [[fit()]
8181
#' @examples
8282
#' mlp(mode = "classification", penalty = 0.01)
8383
#' # Parameters can be represented by a placeholder:

R/multinom_reg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
#' separately saved to disk. In a new session, the object can be
8181
#' reloaded and reattached to the `parsnip` object.
8282
#'
83-
#' @seealso [varying()], [fit()]
83+
#' @seealso [[fit()]
8484
#' @examples
8585
#' multinom_reg()
8686
#' # Parameters can be represented by a placeholder:

R/nearest_neighbor.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#' on new data. This also means that a single value of that function's
6464
#' `kernel` argument (a.k.a `weight_func` here) can be supplied
6565
#'
66-
#' @seealso [varying()], [fit()]
66+
#' @seealso [[fit()]
6767
#'
6868
#' @examples
6969
#' nearest_neighbor(neighbors = 11)

R/nullmodel.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ predict.nullmodel <- function (object, new_data = NULL, type = NULL, ...) {
155155
#' \Sexpr[results=rd]{parsnip:::show_fit(parsnip:::null_model(mode = "regression"), "parsnip")}
156156
#'
157157
#' @importFrom purrr map_lgl
158-
#' @seealso [varying()], [fit()]
158+
#' @seealso [fit()]
159159
#' @examples
160160
#' null_model(mode = "regression")
161161
#' @export

R/rand_forest.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#' reloaded and reattached to the `parsnip` object.
8888
#'
8989
#' @importFrom purrr map_lgl
90-
#' @seealso [varying()], [fit()]
90+
#' @seealso [[fit()]
9191
#' @examples
9292
#' rand_forest(mode = "classification", trees = 2000)
9393
#' # Parameters can be represented by a placeholder:

R/surv_reg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#' predictions when there is a stratification variable and can be
5858
#' overridden in other cases.
5959
#'
60-
#' @seealso [varying()], [fit()], [survival::Surv()]
60+
#' @seealso [[fit()], [survival::Surv()]
6161
#' @references Jackson, C. (2016). `flexsurv`: A Platform for Parametric Survival
6262
#' Modeling in R. _Journal of Statistical Software_, 70(8), 1 - 33.
6363
#' @examples

R/svm_poly.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#' \Sexpr[results=rd]{parsnip:::show_fit(parsnip:::svm_poly(mode = "regression"), "kernlab")}
5252
#'
5353
#' @importFrom purrr map_lgl
54-
#' @seealso [varying()], [fit()]
54+
#' @seealso [[fit()]
5555
#' @examples
5656
#' svm_poly(mode = "classification", degree = 1.2)
5757
#' # Parameters can be represented by a placeholder:

R/svm_rbf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#' \Sexpr[results=rd]{parsnip:::show_fit(parsnip:::svm_rbf(mode = "regression"), "kernlab")}
5151
#'
5252
#' @importFrom purrr map_lgl
53-
#' @seealso [varying()], [fit()]
53+
#' @seealso [fit()]
5454
#' @examples
5555
#' svm_rbf(mode = "classification", rbf_sigma = 0.2)
5656
#' # Parameters can be represented by a placeholder:

docs/dev/404.html

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

0 commit comments

Comments
 (0)