fit_xy.nested_model | R Documentation |
generics::fit_xy()
method for nested models. This should not be
called directly and instead should be called by
workflows::fit.workflow()
.
## S3 method for class 'nested_model'
fit_xy(
object,
x,
y,
case_weights = NULL,
control = parsnip::control_parsnip(),
...
)
object |
An |
x |
A data frame of predictors. |
y |
A data frame of outcome data. |
case_weights |
An optional vector of case weights. Passed into
|
control |
A |
... |
Passed into |
A nested_model_fit
object with several elements:
spec
: The model specification object (the inner model of the
nested model object)
fit
: A tibble containing the model fits and the nests that they
correspond to.
inner_names
: A character vector of names, used to help with
nesting the data during predictions.
parsnip::fit.model_spec()
parsnip::model_fit
library(dplyr)
library(parsnip)
library(recipes)
library(workflows)
data <- filter(example_nested_data, id %in% 11:20)
model <- linear_reg() %>%
set_engine("lm") %>%
nested()
recipe <- recipe(data, z ~ x + y + id) %>%
step_nest(id)
wf <- workflow() %>%
add_recipe(recipe) %>%
add_model(model)
fit(wf, data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.