Skip to content

Commit

Permalink
Extract functions (#388)
Browse files Browse the repository at this point in the history
* extract functions

* more extract changes

* revised notes about model extraction

* added missing description

* small text adjustments

* added word

* add engine

* Update R/extract.R

Co-authored-by: Hannah Frick <[email protected]>

* removed fitting warning

* note on last_fit objects

* Apply suggestions from code review

Co-authored-by: Hannah Frick <[email protected]>
Co-authored-by: Davis Vaughan <[email protected]>

* more deprecation

* less specific remotes

Co-authored-by: Hannah Frick <[email protected]>
Co-authored-by: Davis Vaughan <[email protected]>
  • Loading branch information
3 people authored Jul 2, 2021
1 parent f48f232 commit 3f530f3
Show file tree
Hide file tree
Showing 27 changed files with 613 additions and 274 deletions.
6 changes: 5 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Imports:
ggplot2,
glue,
GPfit,
hardhat (>= 0.1.5.9000),
lifecycle (>= 1.0.0),
parsnip (>= 0.1.4),
purrr (>= 0.3.2),
recipes (>= 0.1.15),
Expand All @@ -39,7 +41,6 @@ Imports:
yardstick (>= 0.0.7)
Suggests:
covr,
hardhat (>= 0.1.5),
kernlab,
knitr,
modeldata,
Expand All @@ -52,3 +53,6 @@ LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1.9000
Language: en-US
Remotes:
tidymodels/hardhat,
tidymodels/workflows
21 changes: 21 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ S3method(collect_metrics,tune_race)
S3method(collect_metrics,tune_results)
S3method(collect_predictions,default)
S3method(collect_predictions,tune_results)
S3method(extract_fit_engine,tune_results)
S3method(extract_fit_parsnip,tune_results)
S3method(extract_mold,tune_results)
S3method(extract_preprocessor,tune_results)
S3method(extract_recipe,tune_results)
S3method(extract_spec_parsnip,tune_results)
S3method(extract_workflow,last_fit)
S3method(extract_workflow,tune_results)
S3method(fit_resamples,default)
S3method(fit_resamples,model_spec)
S3method(fit_resamples,workflow)
Expand Down Expand Up @@ -141,8 +149,14 @@ export(encode_set)
export(estimate_tune_results)
export(exp_improve)
export(expo_decay)
export(extract_fit_engine)
export(extract_fit_parsnip)
export(extract_model)
export(extract_mold)
export(extract_preprocessor)
export(extract_recipe)
export(extract_spec_parsnip)
export(extract_workflow)
export(filter_parameters)
export(finalize_model)
export(finalize_recipe)
Expand Down Expand Up @@ -242,6 +256,13 @@ importFrom(ggplot2,xlab)
importFrom(ggplot2,ylab)
importFrom(glue,glue)
importFrom(glue,glue_collapse)
importFrom(hardhat,extract_fit_engine)
importFrom(hardhat,extract_fit_parsnip)
importFrom(hardhat,extract_mold)
importFrom(hardhat,extract_preprocessor)
importFrom(hardhat,extract_recipe)
importFrom(hardhat,extract_spec_parsnip)
importFrom(hardhat,extract_workflow)
importFrom(parsnip,get_from_env)
importFrom(purrr,map_int)
importFrom(recipes,all_outcomes)
Expand Down
4 changes: 2 additions & 2 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ check_workflow <- function(x, pset = NULL, check_dials = FALSE) {
}
}

mod <- workflows::pull_workflow_spec(x)
mod <- extract_spec_parsnip(x)
check_installs(mod)

invisible(NULL)
Expand All @@ -282,7 +282,7 @@ check_workflow <- function(x, pset = NULL, check_dials = FALSE) {
#' @rdname empty_ellipses
#' @param object A `workflow` object.
check_metrics <- function(x, object) {
mode <- workflows::pull_workflow_spec(object)$mode
mode <- extract_spec_parsnip(object)$mode

if (is.null(x)) {
switch(
Expand Down
Loading

0 comments on commit 3f530f3

Please sign in to comment.