Skip to content

Commit ad4a491

Browse files
authored
missing pkg specification for #752 (#754)
1 parent eb0d94a commit ad4a491

File tree

4 files changed

+54
-12
lines changed

4 files changed

+54
-12
lines changed

NEWS.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
# parsnip (development version)
22

3+
## Model Specification Changes
34

45
* Enable the use of case weights for models that support them.
56

6-
* Added a `glm_grouped()` function to convert long data to the grouped format required by `glm()` for logistic regression.
7-
87
* `show_model_info()` now indicates which models can utilize case weights.
98

10-
* `xgb_train()` now allows for case weights
9+
* Model type functions will now message informatively if a needed parsnip extension package is not loaded (#731).
1110

12-
* Added `ctree_train()` and `cforest_train()` wrappers for the functions in the partykit package. Engines for these will be added to other parsnip extension packages.
11+
* Refactored internals of model specification printing functions. These changes are non-breaking for extension packages, but the new `print_model_spec()` helper is exported for use in extensions if desired (#739).
1312

14-
* Exported `xgb_predict()` which wraps xgboost's `predict()` method for use with parsnip extension packages (#688).
13+
## Bug fixes
1514

1615
* Fixed bug where previously set engine arguments would propagate through `update()` methods despite `fresh = TRUE` (#704).
1716

18-
* An inconsistency for probability type predictions for two-class GAM models was fixed (#708)
17+
* Fixed a bug where an error would be thrown if arguments to model functions were namespaced (#745).
1918

2019
* `predict(type = "prob")` will now provide an error if the outcome variable has a level called `"class"` (#720).
2120

22-
* Added a developer function, `.model_param_name_key` that translates names of tuning parameters.
21+
* An inconsistency for probability type predictions for two-class GAM models was fixed (#708)
2322

24-
* Model type functions will now message informatively if a needed parsnip extension package is not loaded (#731).
23+
* Fixed translated printing for `null_model()` (#752)
2524

26-
* Fixed a bug where an error would be thrown if arguments to model functions were namespaced (#745).
25+
## Other changes
2726

28-
* Refactored internals of model specification printing functions. These changes are non-breaking for extension packages, but the new `print_model_spec()` helper is exported for use in extensions if desired (#739).
27+
* Added a `glm_grouped()` function to convert long data to the grouped format required by `glm()` for logistic regression.
28+
29+
* `xgb_train()` now allows for case weights
30+
31+
* Added `ctree_train()` and `cforest_train()` wrappers for the functions in the partykit package. Engines for these will be added to other parsnip extension packages.
32+
33+
* Exported `xgb_predict()` which wraps xgboost's `predict()` method for use with parsnip extension packages (#688).
34+
35+
* Added a developer function, `.model_param_name_key` that translates names of tuning parameters.
2936

3037

3138
# parsnip 0.2.1

R/nullmodel_data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set_fit(
1616
value = list(
1717
interface = "matrix",
1818
protect = c("x", "y"),
19-
func = c(fun = "nullmodel"),
19+
func = c(fun = "nullmodel", pkg = "parsnip"),
2020
defaults = list()
2121
)
2222
)
@@ -40,7 +40,7 @@ set_fit(
4040
value = list(
4141
interface = "matrix",
4242
protect = c("x", "y"),
43-
func = c(fun = "nullmodel"),
43+
func = c(fun = "nullmodel", pkg = "parsnip"),
4444
defaults = list()
4545
)
4646
)

tests/testthat/_snaps/nullmodel.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# null_model printing
2+
3+
Code
4+
print(null_model(mode = "classification"))
5+
Output
6+
Null Model Specification (classification)
7+
8+
9+
---
10+
11+
Code
12+
print(null_model(mode = "classification") %>% set_engine("parsnip") %>%
13+
translate())
14+
Output
15+
Null Model Specification (classification)
16+
17+
Computational engine: parsnip
18+
19+
Model fit template:
20+
parsnip::nullmodel(x = missing_arg(), y = missing_arg())
21+

tests/testthat/test_nullmodel.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,18 @@ test_that('classification', {
111111
expect_true(!is.null(null_model$fit))
112112
})
113113

114+
# ------------------------------------------------------------------------------
115+
116+
test_that('null_model printing', {
117+
expect_snapshot(print(null_model(mode = "classification")))
118+
expect_snapshot(
119+
print(
120+
null_model(mode = "classification") %>%
121+
set_engine("parsnip") %>%
122+
translate()
123+
)
124+
)
125+
})
126+
127+
114128

0 commit comments

Comments
 (0)