tidymodels / hardhat

Construct Modeling Packages
https://hardhat.tidymodels.org
Other
101 stars 16 forks source link

Standardize `mold()` `outcome` format #107

Closed DavisVaughan closed 4 years ago

DavisVaughan commented 4 years ago

Closes #95

We now consistently return a tibble with as many rows as there are outcomes in the $outcomes slot of mold(). If no outcomes are specified, a 0 column tibble is returned with as many rows are there are predictors.

If the XY method is used, y = NULL pulls the number of rows from x.

recipes juice() currently has a bug where it doesn't return the right number of rows, but that will be fixed by https://github.com/tidymodels/recipes/pull/412 and there is a failing test

library(hardhat)

mold(iris[, "Sepal.Width", drop = FALSE], y = NULL)$outcomes
#> # A tibble: 150 x 0

mold(~ Sepal.Width, iris)$outcomes
#> # A tibble: 150 x 0

rec <- recipes::recipe(iris)
mold(rec, iris)$outcomes
#> # A tibble: 0 x 0

Created on 2019-11-18 by the reprex package (v0.3.0.9000)

github-actions[bot] commented 3 years ago

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.