diff --git a/.travis.yml b/.travis.yml index 0466db939..7fed3b0b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,6 @@ cran: https://cran.rstudio.com warnings_are_errors: false r: - - 3.2 - - 3.3 - - 3.4 - 3.5 - 3.6 - devel @@ -24,34 +21,6 @@ matrix: - r: 3.2 # partykit install failure (libcoin needs >= 3.4.0) - r: 3.4 # mvtnorm requires >= 3.5.0 -r_binary_packages: - - RCurl - - dplyr - - glue - - magrittr - - stringi - - stringr - - munsell - - rlang - - reshape2 - - scales - - tibble - - ggplot2 - - Rcpp - - RcppEigen - - BH - - glmnet - - earth - - sparklyr - - flexsurv - - ranger - - randomforest - - xgboost - - C50 - - reticulate - - scales - - dials - cache: packages: true diff --git a/DESCRIPTION b/DESCRIPTION index 2ff8ed495..d9c46830b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: parsnip -Version: 0.0.3 +Version: 0.0.3.9000 Title: A Common API to Modeling and Analysis Functions 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). Authors@R: c( diff --git a/NEWS.md b/NEWS.md index a505a745f..024f4f38d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# parsnip 0.0.3.9000 + # parsnip 0.0.3 Unplanned release based on CRAN requirements for Solaris. diff --git a/docs/articles/articles/Classification.html b/docs/articles/articles/Classification.html index 2ec6a523f..2dc96fcc0 100644 --- a/docs/articles/articles/Classification.html +++ b/docs/articles/articles/Classification.html @@ -105,25 +105,24 @@

Classification Example

To demonstrate parsnip for classification models, the credit data will be used.

library(tidymodels)
-#> ── Attaching packages ─────────────────────────────────────── tidymodels 0.0.2 ──
-#> ✔ broom     0.5.1          ✔ purrr     0.3.2     
-#> ✔ dials     0.0.2.9000     ✔ recipes   0.1.6     
-#> ✔ dplyr     0.8.3          ✔ rsample   0.0.5     
-#> ✔ infer     0.4.0          ✔ yardstick 0.0.3.9000
-#> ── Conflicts ────────────────────────────────────────── tidymodels_conflicts() ──
+#> ── Attaching packages ───────────────────────────────────────────── tidymodels 0.0.2 ──
+#> ✔ broom     0.5.2       ✔ purrr     0.3.2  
+#> ✔ dials     0.0.2       ✔ recipes   0.1.6  
+#> ✔ dplyr     0.8.3       ✔ rsample   0.0.5  
+#> ✔ infer     0.4.0.1     ✔ yardstick 0.0.3
+#> ── Conflicts ──────────────────────────────────────────────── tidymodels_conflicts() ──
 #> ✖ purrr::discard() masks scales::discard()
 #> ✖ dplyr::filter()  masks stats::filter()
 #> ✖ dplyr::lag()     masks stats::lag()
-#> ✖ dials::margin()  masks ggplot2::margin()
-#> ✖ recipes::step()  masks stats::step()
-
-data(credit_data)
-
-set.seed(7075)
-data_split <- initial_split(credit_data, strata = "Status", p = 0.75)
-
-credit_train <- training(data_split)
-credit_test  <- testing(data_split)
+#> ✖ recipes::step() masks stats::step() + +data(credit_data) + +set.seed(7075) +data_split <- initial_split(credit_data, strata = "Status", p = 0.75) + +credit_train <- training(data_split) +credit_test <- testing(data_split)

A single hidden layer neural network will be used to predict a person’s credit status. To do so, the columns of the predictor matrix should be numeric and on a common scale. recipes will be used to do so.

credit_rec <- 
   recipe(Status ~ ., data = credit_train) %>%
@@ -185,12 +184,12 @@ 

Classification Example

#> # A tibble: 1 x 3 #> .metric .estimator .estimate #> <chr> <chr> <dbl> -#> 1 accuracy binary 0.804 +#> 1 accuracy binary 0.803 test_results %>% conf_mat(truth = Status, nnet_class) #> Truth #> Prediction bad good -#> bad 191 96 -#> good 122 704
+#> bad 183 89 +#> good 130 711 @@ -99,6 +100,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -115,6 +119,7 @@ +
    @@ -130,6 +135,7 @@

    Page not found (404)

    +

    parsnip is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    @@ -141,11 +147,14 @@

    Page not found (404)

    Site built by pkgdown.

    +
    + + diff --git a/docs/dev/articles/articles/Classification.html b/docs/dev/articles/articles/Classification.html index 9f5ef1ac1..65addb71d 100644 --- a/docs/dev/articles/articles/Classification.html +++ b/docs/dev/articles/articles/Classification.html @@ -41,7 +41,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -69,6 +69,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -87,6 +90,7 @@ +

    A single hidden layer neural network will be used to predict a person’s credit status. To do so, the columns of the predictor matrix should be numeric and on a common scale. recipes will be used to do so.

    +#> bad 188 95 +#> good 125 705
    +

    parsnip is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    @@ -208,10 +210,12 @@

    Classification Example

    Site built by pkgdown.

    +
    + diff --git a/docs/dev/articles/articles/Models.html b/docs/dev/articles/articles/Models.html index c6995e6cc..dcec9dcdb 100644 --- a/docs/dev/articles/articles/Models.html +++ b/docs/dev/articles/articles/Models.html @@ -41,7 +41,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -69,6 +69,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -87,6 +90,7 @@ +
  • Arguments
  • + +
  • References
  • + +
  • Examples
  • + + + + diff --git a/docs/dev/reference/has_multi_predict.html b/docs/dev/reference/has_multi_predict.html new file mode 100644 index 000000000..f6c585b68 --- /dev/null +++ b/docs/dev/reference/has_multi_predict.html @@ -0,0 +1,248 @@ + + + + + + + + +Tools for models that predict on sub-models — has_multi_predict • parsnip + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    + +

    has_multi_predict() tests to see if an object can make multiple +predictions on submodels from the same object. multi_predict_args() +returns the names of the argments to multi_predict() for this model +(if any).

    + +
    + +
    has_multi_predict(object, ...)
    +
    +# S3 method for default
    +has_multi_predict(object, ...)
    +
    +# S3 method for model_fit
    +has_multi_predict(object, ...)
    +
    +# S3 method for workflow
    +has_multi_predict(object, ...)
    +
    +multi_predict_args(object, ...)
    +
    +# S3 method for default
    +multi_predict_args(object, ...)
    +
    +# S3 method for model_fit
    +multi_predict_args(object, ...)
    +
    +# S3 method for workflow
    +multi_predict_args(object, ...)
    + +

    Arguments

    + + + + + + + + + + +
    object

    An object to test.

    ...

    Not currently used.

    + +

    Value

    + +

    has_multi_predict() returns single logical value while +multi_predict() returns a character vector of argument names (or NA +if none exist).

    + + +

    Examples

    +
    lm_model_idea <- linear_reg() %>% set_engine("lm") +has_multi_predict(lm_model_idea)
    #> [1] FALSE
    lm_model_fit <- fit(lm_model_idea, mpg ~ ., data = mtcars) +has_multi_predict(lm_model_fit)
    #> [1] FALSE
    +multi_predict_args(lm_model_fit)
    #> [1] NA
    +library(kknn) + +knn_fit <- + nearest_neighbor(mode = "regression", neighbors = 5) %>% + set_engine("kknn") %>% + fit(mpg ~ ., mtcars) + +multi_predict_args(knn_fit)
    #> [1] "neighbors"
    +multi_predict(knn_fit, mtcars[1, -1], neighbors = 1:4)$.pred
    #> [[1]] +#> # A tibble: 4 x 2 +#> neighbors .pred +#> <int> <dbl> +#> 1 1 21 +#> 2 2 21 +#> 3 3 20.9 +#> 4 4 21.0 +#>
    +
    + +
    + + +
    +
    +

    parsnip is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    +
    + +
    +

    + Developed by Max Kuhn, Davis Vaughan. + Site built by pkgdown. +

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html index 0540feb14..bf6b5992e 100644 --- a/docs/dev/reference/index.html +++ b/docs/dev/reference/index.html @@ -52,6 +52,7 @@ gtag('config', 'UA-115082821-1'); + @@ -71,7 +72,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -99,6 +100,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -115,6 +119,7 @@ +
    @@ -275,7 +280,7 @@

    multi_predict()

    +

    multi_predict

    Model predictions across many sub-models

    @@ -345,7 +350,7 @@

    pred_types check_mod_val() get_model_env() check_mode_val() check_engine_val() check_arg_val() check_submodels_val() check_func_val() check_fit_info() check_pred_info() check_pkg_val() set_new_model() set_model_mode() set_model_engine() set_model_arg() set_dependency() get_dependency() set_fit() get_fit() set_pred() get_pred_type() show_model_info() get_from_env()

    +

    set_new_model() set_model_mode() set_model_engine() set_model_arg() set_dependency() get_dependency() set_fit() get_fit() set_pred() get_pred_type() show_model_info() pred_value_template()

    Tools to Register Models

    @@ -364,6 +369,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/keras_mlp.html b/docs/dev/reference/keras_mlp.html index ed96c15ed..251c32769 100644 --- a/docs/dev/reference/keras_mlp.html +++ b/docs/dev/reference/keras_mlp.html @@ -57,6 +57,7 @@ gtag('config', 'UA-115082821-1'); + @@ -76,7 +77,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -104,6 +105,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -120,6 +124,7 @@ +
    @@ -203,6 +208,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/lending_club.html b/docs/dev/reference/lending_club.html index bb62cc077..14b17f066 100644 --- a/docs/dev/reference/lending_club.html +++ b/docs/dev/reference/lending_club.html @@ -55,6 +55,7 @@ gtag('config', 'UA-115082821-1'); + @@ -74,7 +75,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -102,6 +103,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -118,6 +122,7 @@ +
    @@ -200,6 +205,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/linear_reg.html b/docs/dev/reference/linear_reg.html index 31dfc2fbf..76c7a21b4 100644 --- a/docs/dev/reference/linear_reg.html +++ b/docs/dev/reference/linear_reg.html @@ -68,6 +68,7 @@ gtag('config', 'UA-115082821-1'); + @@ -87,7 +88,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -115,6 +116,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -131,6 +135,7 @@ +
    @@ -262,9 +267,9 @@

    -

    When using glmnet models, there is the option to pass -multiple values (or no values) to the penalty argument. This -can have an effect on the model object results. When using the +

    For glmnet models, the full regularization path is always fit regardless +of the value given to penalty. Also, there is the option to pass +multiple values (or no values) to the penalty argument. When using the predict() method in these cases, the return value depends on the value of penalty. When using predict(), only a single value of the penalty can be used. When predicting on multiple @@ -326,6 +331,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/logistic_reg.html b/docs/dev/reference/logistic_reg.html index ca4332916..996296a74 100644 --- a/docs/dev/reference/logistic_reg.html +++ b/docs/dev/reference/logistic_reg.html @@ -68,6 +68,7 @@ gtag('config', 'UA-115082821-1'); + @@ -87,7 +88,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -115,6 +116,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -131,6 +135,7 @@ +
    @@ -261,9 +266,9 @@

    -

    When using glmnet models, there is the option to pass -multiple values (or no values) to the penalty argument. This -can have an effect on the model object results. When using the +

    For glmnet models, the full regularization path is always fit regardless +of the value given to penalty. Also, there is the option to pass +multiple values (or no values) to the penalty argument. When using the predict() method in these cases, the return value depends on the value of penalty. When using predict(), only a single value of the penalty can be used. When predicting on multiple @@ -326,6 +331,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/make_classes.html b/docs/dev/reference/make_classes.html index 7a43980cb..5cbbc05b9 100644 --- a/docs/dev/reference/make_classes.html +++ b/docs/dev/reference/make_classes.html @@ -55,6 +55,7 @@ gtag('config', 'UA-115082821-1'); + @@ -74,7 +75,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -102,6 +103,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -118,6 +122,7 @@ +
    @@ -162,6 +167,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/mars.html b/docs/dev/reference/mars.html index fafee1c3a..026bdcc56 100644 --- a/docs/dev/reference/mars.html +++ b/docs/dev/reference/mars.html @@ -71,6 +71,7 @@ gtag('config', 'UA-115082821-1'); + @@ -90,7 +91,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -118,6 +119,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -134,6 +138,7 @@ +
    @@ -281,6 +286,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/min_grid.html b/docs/dev/reference/min_grid.html new file mode 100644 index 000000000..f84bf9682 --- /dev/null +++ b/docs/dev/reference/min_grid.html @@ -0,0 +1,223 @@ + + + + + + + + +Determine the minimum set of model fits — min_grid • parsnip + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    + +

    min_grid determines exactly what models should be fit in order to +evaluate the entire set of tuning parameter combinations. This is for +internal use only and the API may change in the near future.

    + +
    + +
    min_grid(x, grid, ...)
    +
    +# S3 method for boost_tree
    +min_grid(x, grid, ...)
    +
    +# S3 method for linear_reg
    +min_grid(x, grid, ...)
    +
    +# S3 method for logistic_reg
    +min_grid(x, grid, ...)
    +
    +# S3 method for mars
    +min_grid(x, grid, ...)
    +
    +# S3 method for multinom_reg
    +min_grid(x, grid, ...)
    +
    +# S3 method for nearest_neighbor
    +min_grid(x, grid, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    x

    A model specification.

    grid

    A tibble with tuning parameter combinations.

    ...

    Not currently used.

    + +

    Value

    + +

    A tibble with the minimum tuning parameters to fit and an additional +list column with the parameter combinations used for prediction.

    + + +
    + +
    + + +
    +
    +

    parsnip is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    +
    + +
    +

    + Developed by Max Kuhn, Davis Vaughan. + Site built by pkgdown. +

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mlp.html b/docs/dev/reference/mlp.html index e9b746b82..9d3767027 100644 --- a/docs/dev/reference/mlp.html +++ b/docs/dev/reference/mlp.html @@ -71,6 +71,7 @@ gtag('config', 'UA-115082821-1'); + @@ -90,7 +91,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -118,6 +119,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -134,6 +138,7 @@ +
    @@ -318,6 +323,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/model_fit.html b/docs/dev/reference/model_fit.html index a800662ad..357121f69 100644 --- a/docs/dev/reference/model_fit.html +++ b/docs/dev/reference/model_fit.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -204,6 +209,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/model_printer.html b/docs/dev/reference/model_printer.html index 3165048e4..8cd752ae7 100644 --- a/docs/dev/reference/model_printer.html +++ b/docs/dev/reference/model_printer.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -162,6 +167,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/model_spec.html b/docs/dev/reference/model_spec.html index a37f6356c..4cc2fa42f 100644 --- a/docs/dev/reference/model_spec.html +++ b/docs/dev/reference/model_spec.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -256,6 +261,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/multi_predict.html b/docs/dev/reference/multi_predict.html index cbef60645..4c38f401e 100644 --- a/docs/dev/reference/multi_predict.html +++ b/docs/dev/reference/multi_predict.html @@ -55,6 +55,7 @@ gtag('config', 'UA-115082821-1'); + @@ -74,7 +75,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -102,6 +103,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -118,6 +122,7 @@ +
    @@ -137,7 +142,35 @@

    Model predictions across many sub-models

    multi_predict(object, ...)
     
     # S3 method for default
    -multi_predict(object, ...)
    +multi_predict(object, ...) + +# S3 method for _xgb.Booster +multi_predict(object, new_data, type = NULL, + trees = NULL, ...) + +# S3 method for _C5.0 +multi_predict(object, new_data, type = NULL, + trees = NULL, ...) + +# S3 method for _elnet +multi_predict(object, new_data, type = NULL, + penalty = NULL, ...) + +# S3 method for _lognet +multi_predict(object, new_data, type = NULL, + penalty = NULL, ...) + +# S3 method for _earth +multi_predict(object, new_data, type = NULL, + num_terms = NULL, ...) + +# S3 method for _multnet +multi_predict(object, new_data, type = NULL, + penalty = NULL, ...) + +# S3 method for _train.kknn +multi_predict(object, new_data, type = NULL, + neighbors = NULL, ...)

    Arguments

    @@ -151,6 +184,33 @@

    Arg

    + + + + + + + + + + + + + + + + + + + + + + + +

    Optional arguments to pass to predict.model_fit(type = "raw") such as type.

    new_data

    A rectangular data object, such as a data frame.

    type

    A single character value or NULL. Possible values +are "numeric", "class", "prob", "conf_int", "pred_int", "quantile", +or "raw". When NULL, predict() will choose an appropriate value +based on the model's mode.

    trees

    An integer vector for the number of trees in the ensemble.

    penalty

    An numeric vector of penalty values.

    num_terms

    An integer vector for the number of MARS terms to retain.

    neighbors

    An integer vector for the number of nearest neighbors.

    Value

    @@ -172,6 +232,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/multinom_reg.html b/docs/dev/reference/multinom_reg.html index 7454d2238..466b4632c 100644 --- a/docs/dev/reference/multinom_reg.html +++ b/docs/dev/reference/multinom_reg.html @@ -68,6 +68,7 @@ gtag('config', 'UA-115082821-1'); + @@ -87,7 +88,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -115,6 +116,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -131,6 +135,7 @@ +
    @@ -250,9 +255,9 @@

    -

    When using glmnet models, there is the option to pass -multiple values (or no values) to the penalty argument. This -can have an effect on the model object results. When using the +

    For glmnet models, the full regularization path is always fit regardless +of the value given to penalty. Also, there is the option to pass +multiple values (or no values) to the penalty argument. When using the predict() method in these cases, the return value depends on the value of penalty. When using predict(), only a single value of the penalty can be used. When predicting on multiple @@ -308,6 +313,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/nearest_neighbor.html b/docs/dev/reference/nearest_neighbor.html index d22c15948..cc5e17664 100644 --- a/docs/dev/reference/nearest_neighbor.html +++ b/docs/dev/reference/nearest_neighbor.html @@ -71,6 +71,7 @@ gtag('config', 'UA-115082821-1'); + @@ -90,7 +91,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -118,6 +119,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -134,6 +138,7 @@ +
    @@ -257,6 +262,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/null_model.html b/docs/dev/reference/null_model.html index 53eb934a3..d4f00f0f3 100644 --- a/docs/dev/reference/null_model.html +++ b/docs/dev/reference/null_model.html @@ -57,6 +57,7 @@ gtag('config', 'UA-115082821-1'); + @@ -76,7 +77,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -104,6 +105,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -120,6 +124,7 @@ +
    @@ -199,6 +204,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/nullmodel.html b/docs/dev/reference/nullmodel.html index ed7909a78..72173402d 100644 --- a/docs/dev/reference/nullmodel.html +++ b/docs/dev/reference/nullmodel.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -232,6 +237,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/predict.model_fit.html b/docs/dev/reference/predict.model_fit.html index 4c6df5f30..ec5978cff 100644 --- a/docs/dev/reference/predict.model_fit.html +++ b/docs/dev/reference/predict.model_fit.html @@ -57,6 +57,7 @@ gtag('config', 'UA-115082821-1'); + @@ -76,7 +77,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -104,6 +105,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -120,6 +124,7 @@ +
    @@ -318,6 +323,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/rand_forest.html b/docs/dev/reference/rand_forest.html index 1dea25281..6dfcf5750 100644 --- a/docs/dev/reference/rand_forest.html +++ b/docs/dev/reference/rand_forest.html @@ -69,6 +69,7 @@ gtag('config', 'UA-115082821-1'); + @@ -88,7 +89,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -116,6 +117,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -132,6 +136,7 @@ +
    @@ -323,6 +328,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/reexports.html b/docs/dev/reference/reexports.html index 3f8af8092..5fba8a0ad 100644 --- a/docs/dev/reference/reexports.html +++ b/docs/dev/reference/reexports.html @@ -61,6 +61,7 @@ gtag('config', 'UA-115082821-1'); + @@ -80,7 +81,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -108,6 +109,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -124,6 +128,7 @@ +
    @@ -157,6 +162,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/rpart_train.html b/docs/dev/reference/rpart_train.html index 79087d510..28bbd0e27 100644 --- a/docs/dev/reference/rpart_train.html +++ b/docs/dev/reference/rpart_train.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -202,6 +207,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/set_args.html b/docs/dev/reference/set_args.html index 5a0540165..182780a8d 100644 --- a/docs/dev/reference/set_args.html +++ b/docs/dev/reference/set_args.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -197,6 +202,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/set_engine.html b/docs/dev/reference/set_engine.html index 539fc613d..f7b67d3b5 100644 --- a/docs/dev/reference/set_engine.html +++ b/docs/dev/reference/set_engine.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -196,6 +201,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/set_new_model.html b/docs/dev/reference/set_new_model.html new file mode 100644 index 000000000..239fec458 --- /dev/null +++ b/docs/dev/reference/set_new_model.html @@ -0,0 +1,356 @@ + + + + + + + + +Tools to Register Models — set_new_model • parsnip + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    + +

    These functions are similar to constructors and can be used to validate +that there are no conflicts with the underlying model structures used by the +package.

    + +
    + +
    set_new_model(model)
    +
    +set_model_mode(model, mode)
    +
    +set_model_engine(model, mode, eng)
    +
    +set_model_arg(model, eng, parsnip, original, func, has_submodel)
    +
    +set_dependency(model, eng, pkg)
    +
    +get_dependency(model)
    +
    +set_fit(model, mode, eng, value)
    +
    +get_fit(model)
    +
    +set_pred(model, mode, eng, type, value)
    +
    +get_pred_type(model, type)
    +
    +show_model_info(model)
    +
    +pred_value_template(pre = NULL, post = NULL, func, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    model

    A single character string for the model type (e.g. +"rand_forest", etc).

    mode

    A single character string for the model mode (e.g. "regression").

    eng

    A single character string for the model engine.

    parsnip

    A single character string for the "harmonized" argument name +that parsnip exposes.

    original

    A single character string for the argument name that +underlying model function uses.

    func

    A named character vector that describes how to call +a function. func should have elements pkg and fun. The +former is optional but is recommended and the latter is +required. For example, c(pkg = "stats", fun = "lm") would be +used to invoke the usual linear regression function. In some +cases, it is helpful to use c(fun = "predict") when using a +package's predict method.

    has_submodel

    A single logical for whether the argument +can make predictions on mutiple submodels at once.

    pkg

    An options character string for a package name.

    value

    A list that conforms to the fit_obj or pred_obj description +above, depending on context.

    type

    A single character value for the type of prediction. Possible +values are: class, conf_int, numeric, pred_int, prob, quantile, +and raw.

    pre, post

    Optional functions for pre- and post-processing of prediction +results.

    ...

    Optional arguments that should be passed into the args slot for +prediction objects.

    arg

    A single character string for the model argument name.

    fit_obj

    A list with elements interface, protect, +func and defaults. See the package vignette "Making a +parsnip model from scratch".

    pred_obj

    A list with elements pre, post, func, and args. +See the package vignette "Making a parsnip model from scratch".

    + +

    Details

    + +

    These functions are available for users to add their +own models or engines (in package or otherwise) so that they can +be accessed using parsnip. This are more thoroughly documented +on the package web site (see references below).

    +

    In short, parsnip stores an environment object that contains +all of the information and code about how models are used (e.g. +fitting, predicting, etc). These functions can be used to add +models to that environment as well as helper functions that can +be used to makes sure that the model data is in the right +format.

    +

    check_model_exists() checks the model value and ensures that the model has +already been registered. check_model_doesnt_exist() checks the model value +and also checks to see if it is novel in the environment.

    + +

    References

    + +

    "Making a parsnip model from scratch" +https://tidymodels.github.io/parsnip/articles/articles/Scratch.html

    + + +

    Examples

    +
    # set_new_model("shallow_learning_model") + +# Show the information about a model: +show_model_info("rand_forest")
    #> Information for `rand_forest` +#> modes: unknown, classification, regression +#> +#> engines: +#> classification: randomForest, ranger, spark +#> regression: randomForest, ranger, spark +#> +#> arguments: +#> ranger: +#> mtry --> mtry +#> trees --> num.trees +#> min_n --> min.node.size +#> randomForest: +#> mtry --> mtry +#> trees --> ntree +#> min_n --> nodesize +#> spark: +#> mtry --> feature_subset_strategy +#> trees --> num_trees +#> min_n --> min_instances_per_node +#> +#> fit modules: +#> engine mode +#> ranger classification +#> ranger regression +#> randomForest classification +#> randomForest regression +#> spark classification +#> spark regression +#> +#> prediction modules: +#> mode engine methods +#> classification randomForest class, prob, raw +#> classification ranger class, conf_int, prob, raw +#> classification spark class, prob +#> regression randomForest numeric, raw +#> regression ranger conf_int, numeric, raw +#> regression spark numeric +#>
    +
    + +
    + + +
    +
    +

    parsnip is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    +
    + +
    +

    + Developed by Max Kuhn, Davis Vaughan. + Site built by pkgdown. +

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/show_call.html b/docs/dev/reference/show_call.html index c694e9adc..788ebd542 100644 --- a/docs/dev/reference/show_call.html +++ b/docs/dev/reference/show_call.html @@ -55,6 +55,7 @@ gtag('config', 'UA-115082821-1'); + @@ -74,7 +75,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -102,6 +103,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -118,6 +122,7 @@ +
    @@ -162,6 +167,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/surv_reg.html b/docs/dev/reference/surv_reg.html index 31b3d2a9a..bf3ced38d 100644 --- a/docs/dev/reference/surv_reg.html +++ b/docs/dev/reference/surv_reg.html @@ -66,6 +66,7 @@ gtag('config', 'UA-115082821-1'); + @@ -85,7 +86,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -113,6 +114,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -129,6 +133,7 @@ +
    @@ -274,6 +279,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/svm_poly.html b/docs/dev/reference/svm_poly.html index 3d59e9275..1c53bbfff 100644 --- a/docs/dev/reference/svm_poly.html +++ b/docs/dev/reference/svm_poly.html @@ -70,6 +70,7 @@ gtag('config', 'UA-115082821-1'); + @@ -89,7 +90,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -117,6 +118,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -133,6 +137,7 @@ +
    @@ -285,6 +290,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/svm_rbf.html b/docs/dev/reference/svm_rbf.html index 7b4e682a4..3398d87d9 100644 --- a/docs/dev/reference/svm_rbf.html +++ b/docs/dev/reference/svm_rbf.html @@ -70,6 +70,7 @@ gtag('config', 'UA-115082821-1'); + @@ -89,7 +90,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -117,6 +118,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -133,6 +137,7 @@ +
    @@ -281,6 +286,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/tidy.model_fit.html b/docs/dev/reference/tidy.model_fit.html index 3f2a45856..456457987 100644 --- a/docs/dev/reference/tidy.model_fit.html +++ b/docs/dev/reference/tidy.model_fit.html @@ -55,6 +55,7 @@ gtag('config', 'UA-115082821-1'); + @@ -74,7 +75,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -102,6 +103,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -118,6 +122,7 @@ +
    @@ -166,6 +171,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/translate.html b/docs/dev/reference/translate.html index 0b00a588c..3c09631e1 100644 --- a/docs/dev/reference/translate.html +++ b/docs/dev/reference/translate.html @@ -57,6 +57,7 @@ gtag('config', 'UA-115082821-1'); + @@ -76,7 +77,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -104,6 +105,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -120,6 +124,7 @@ +
    @@ -183,7 +188,7 @@

    Examp #> #> Model fit template: #> glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(), -#> lambda = 0.01, family = "gaussian")

    +#> family = "gaussian")
    # `penalty` not applicable for this model. translate(lm_spec, engine = "lm")
    #> Linear Regression Model Specification (regression) #> @@ -231,6 +236,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/type_sum.model_spec.html b/docs/dev/reference/type_sum.model_spec.html index 1eaf4d4fd..7f2fffdfa 100644 --- a/docs/dev/reference/type_sum.model_spec.html +++ b/docs/dev/reference/type_sum.model_spec.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -179,6 +184,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/varying.html b/docs/dev/reference/varying.html index 1c4bfc250..8016ed088 100644 --- a/docs/dev/reference/varying.html +++ b/docs/dev/reference/varying.html @@ -55,6 +55,7 @@ gtag('config', 'UA-115082821-1'); + @@ -74,7 +75,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -102,6 +103,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -118,6 +122,7 @@ +
    @@ -146,6 +151,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/varying_args.model_spec.html b/docs/dev/reference/varying_args.model_spec.html index 526546ac9..c83f8de38 100644 --- a/docs/dev/reference/varying_args.model_spec.html +++ b/docs/dev/reference/varying_args.model_spec.html @@ -57,6 +57,7 @@ gtag('config', 'UA-115082821-1'); + @@ -76,7 +77,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -104,6 +105,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -120,6 +124,7 @@ +
    @@ -243,6 +248,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/wa_churn.html b/docs/dev/reference/wa_churn.html index d14010e43..fc7942f17 100644 --- a/docs/dev/reference/wa_churn.html +++ b/docs/dev/reference/wa_churn.html @@ -55,6 +55,7 @@ gtag('config', 'UA-115082821-1'); + @@ -74,7 +75,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -102,6 +103,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -118,6 +122,7 @@ +
    @@ -197,6 +202,7 @@

    Contents

    + + + diff --git a/docs/dev/reference/xgb_train.html b/docs/dev/reference/xgb_train.html index ce1535165..898e5c26c 100644 --- a/docs/dev/reference/xgb_train.html +++ b/docs/dev/reference/xgb_train.html @@ -56,6 +56,7 @@ gtag('config', 'UA-115082821-1'); + @@ -75,7 +76,7 @@ parsnip
    part of tidymodels - 0.0.2.9000 + 0.0.3.9000
    @@ -103,6 +104,9 @@
  • Making a parsnip model from scratch
  • +
  • + Evaluating submodels with the same model object +
  • @@ -119,6 +123,7 @@ +
    @@ -204,6 +209,7 @@

    Contents

    + + + diff --git a/docs/index.html b/docs/index.html index af96dbb82..3ede6f71d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -173,8 +173,8 @@

    Dev status

    diff --git a/docs/news/index.html b/docs/news/index.html index 712020170..c6d19e821 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -138,8 +138,8 @@

    Breaking Changes

    @@ -150,8 +150,9 @@

    @@ -224,7 +225,7 @@