Skip to content
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
13 changes: 6 additions & 7 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'devel'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6'}
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
Expand Down Expand Up @@ -54,12 +54,11 @@ jobs:

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "16.04"), sep = "\n")')

- name: Install dependencies
run: |
Expand Down Expand Up @@ -102,7 +101,7 @@ jobs:

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
13 changes: 5 additions & 8 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,15 @@ jobs:

- name: Install dependencies
run: |
install.packages("remotes")
remotes::install_deps(dependencies = TRUE)
remotes::install_dev("pkgdown")
remotes::install_github("tidyverse/tidytemplate")
remotes::install_cran("tidymodels")
remotes::install_cran("C50")
remotes::install_cran("modeldata")
install.packages("pkgdown")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: pkgdown::deploy_to_branch(new_process = FALSE)
shell: Rscript {0}
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
4 changes: 4 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
run: Rscript -e 'roxygen2::roxygenise()'
- name: commit
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add man/\* NAMESPACE
git commit -m 'Document'
- uses: r-lib/actions/pr-push@master
Expand All @@ -44,6 +46,8 @@ jobs:
run: Rscript -e 'styler::style_pkg()'
- name: commit
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add \*.R
git commit -m 'Style'
- uses: r-lib/actions/pr-push@master
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Imports:
prettyunits,
vctrs (>= 0.2.0)
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0.9000
RoxygenNote: 7.1.1
Suggests:
testthat,
knitr,
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

S3method(fit,model_spec)
S3method(fit_xy,model_spec)
S3method(glance,model_fit)
S3method(has_multi_predict,default)
S3method(has_multi_predict,model_fit)
S3method(has_multi_predict,workflow)
Expand Down Expand Up @@ -121,6 +122,7 @@ export(get_fit)
export(get_from_env)
export(get_model_env)
export(get_pred_type)
export(glance)
export(has_multi_predict)
export(is_varying)
export(keras_mlp)
Expand Down Expand Up @@ -198,6 +200,7 @@ importFrom(dplyr,tally)
importFrom(dplyr,vars)
importFrom(generics,fit)
importFrom(generics,fit_xy)
importFrom(generics,glance)
importFrom(generics,tidy)
importFrom(generics,varying_args)
importFrom(glue,glue_collapse)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# parsnip (development version)

* A `glance()` method for `model_fit` objects was added (#325)

* Specific `tidy()` methods for `glmnet` models fit via `parsnip` were created so that the coefficients for the specific fitted `parsnip` model are returned.

# parsnip 0.1.2
Expand Down
5 changes: 5 additions & 0 deletions R/reexports.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ generics::fit_xy
#' @importFrom generics tidy
#' @export
generics::tidy


#' @importFrom generics glance
#' @export
generics::glance
11 changes: 11 additions & 0 deletions R/tidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@
#' @return a tibble
#' @export
tidy.model_fit <- function(x, ...) generics::tidy(x$fit, ...)


#' Construct a single row summary "glance" of a model, fit, or other object
#'
#' This method glances the model in a parsnip model object, if it exists.
#'
#' @inheritParams generics::glance
#'
#' @return a tibble
#' @export
glance.model_fit <- function(x, ...) generics::glance(x$fit, ...)
1 change: 1 addition & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
s3_register("broom::tidy", "_lognet")
s3_register("broom::tidy", "_multnet")
s3_register("broom::tidy", "_fishnet")
s3_register("broom::glance", "model_fit")
}


Expand Down
2 changes: 2 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ knitr::opts_chunk$set(
[![CRAN status](https://www.r-pkg.org/badges/version/parsnip)](https://CRAN.R-project.org/package=parsnip)
[![Downloads](http://cranlogs.r-pkg.org/badges/parsnip)](https://cran.rstudio.com/package=parsnip)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![R build status](https://github.com/tidymodels/parsnip/workflows/R-CMD-check/badge.svg)](https://github.com/tidymodels/parsnip/actions)
<!-- badges: end -->

## Introduction
Expand Down Expand Up @@ -112,6 +113,7 @@ rand_forest(mtry = 10, trees = 2000) %>%
Either one of these model specifications can be fit in the same way:

```{r}
set.seed(192)
rand_forest(mtry = 10, trees = 2000) %>%
set_engine("ranger", importance = "impurity") %>%
set_mode("regression") %>%
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ status](https://codecov.io/gh/tidymodels/parsnip/branch/master/graph/badge.svg)]
status](https://www.r-pkg.org/badges/version/parsnip)](https://CRAN.R-project.org/package=parsnip)
[![Downloads](http://cranlogs.r-pkg.org/badges/parsnip)](https://cran.rstudio.com/package=parsnip)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![R build
status](https://github.com/tidymodels/parsnip/workflows/R-CMD-check/badge.svg)](https://github.com/tidymodels/parsnip/actions)
<!-- badges: end -->

## Introduction
Expand Down Expand Up @@ -134,13 +136,14 @@ rand_forest(mtry = 10, trees = 2000) %>%
Either one of these model specifications can be fit in the same way:

``` r
set.seed(192)
rand_forest(mtry = 10, trees = 2000) %>%
set_engine("ranger", importance = "impurity") %>%
set_mode("regression") %>%
fit(mpg ~ ., data = mtcars)
#> parsnip model object
#>
#> Fit time: 71ms
#> Fit time: 69ms
#> Ranger result
#>
#> Call:
Expand All @@ -154,8 +157,8 @@ rand_forest(mtry = 10, trees = 2000) %>%
#> Target node size: 5
#> Variable importance mode: impurity
#> Splitrule: variance
#> OOB prediction error (MSE): 5.699772
#> R squared (OOB): 0.8430857
#> OOB prediction error (MSE): 5.976917
#> R squared (OOB): 0.8354559
```

A list of all `parsnip` models across different CRAN packages can be
Expand Down
19 changes: 19 additions & 0 deletions man/glance.model_fit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.