Skip to content

missing pkg specification for #752 #754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
# parsnip (development version)

## Model Specification Changes

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

* Added a `glm_grouped()` function to convert long data to the grouped format required by `glm()` for logistic regression.

* `show_model_info()` now indicates which models can utilize case weights.

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

* 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.
* 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).

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

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

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

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

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

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

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

* 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).
* Added a `glm_grouped()` function to convert long data to the grouped format required by `glm()` for logistic regression.

* `xgb_train()` now allows for case weights

* 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.

* Exported `xgb_predict()` which wraps xgboost's `predict()` method for use with parsnip extension packages (#688).

* Added a developer function, `.model_param_name_key` that translates names of tuning parameters.


# parsnip 0.2.1
Expand Down
4 changes: 2 additions & 2 deletions R/nullmodel_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set_fit(
value = list(
interface = "matrix",
protect = c("x", "y"),
func = c(fun = "nullmodel"),
func = c(fun = "nullmodel", pkg = "parsnip"),
defaults = list()
)
)
Expand All @@ -40,7 +40,7 @@ set_fit(
value = list(
interface = "matrix",
protect = c("x", "y"),
func = c(fun = "nullmodel"),
func = c(fun = "nullmodel", pkg = "parsnip"),
defaults = list()
)
)
Expand Down
21 changes: 21 additions & 0 deletions tests/testthat/_snaps/nullmodel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# null_model printing

Code
print(null_model(mode = "classification"))
Output
Null Model Specification (classification)


---

Code
print(null_model(mode = "classification") %>% set_engine("parsnip") %>%
translate())
Output
Null Model Specification (classification)

Computational engine: parsnip

Model fit template:
parsnip::nullmodel(x = missing_arg(), y = missing_arg())

14 changes: 14 additions & 0 deletions tests/testthat/test_nullmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,18 @@ test_that('classification', {
expect_true(!is.null(null_model$fit))
})

# ------------------------------------------------------------------------------

test_that('null_model printing', {
expect_snapshot(print(null_model(mode = "classification")))
expect_snapshot(
print(
null_model(mode = "classification") %>%
set_engine("parsnip") %>%
translate()
)
)
})