Skip to content

Commit 67125a7

Browse files
pull_workflow_fit -> extract_fit_parsnip
1 parent 1bd066c commit 67125a7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

source/regression2.Rmd

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,16 +263,16 @@ hidden_print(lm_fit)
263263
> the best fit coefficients are usually easier to interpret afterward.
264264
265265
Our coefficients are
266-
(intercept) $\beta_0=$ `r format(round(pull(tidy(pull_workflow_fit(lm_fit)), estimate)[1]), scientific=FALSE)`
267-
and (slope) $\beta_1=$ `r format(round(pull(tidy(pull_workflow_fit(lm_fit)), estimate)[2]), scientific=FALSE)`.
266+
(intercept) $\beta_0=$ `r format(round(pull(tidy(extract_fit_parsnip(lm_fit)), estimate)[1]), scientific=FALSE)`
267+
and (slope) $\beta_1=$ `r format(round(pull(tidy(extract_fit_parsnip(lm_fit)), estimate)[2]), scientific=FALSE)`.
268268
This means that the equation of the line of best fit is
269269

270-
$$\text{house sale price} = `r format(round(pull(tidy(pull_workflow_fit(lm_fit)), estimate)[1]), scientific=FALSE)` + `r format(round(pull(tidy(pull_workflow_fit(lm_fit)), estimate)[2]), scientific=FALSE)`\cdot (\text{house size}).$$
270+
$$\text{house sale price} = `r format(round(pull(tidy(extract_fit_parsnip(lm_fit)), estimate)[1]), scientific=FALSE)` + `r format(round(pull(tidy(extract_fit_parsnip(lm_fit)), estimate)[2]), scientific=FALSE)`\cdot (\text{house size}).$$
271271

272272
In other words, the model predicts that houses
273-
start at \$`r format(round(pull(tidy(pull_workflow_fit(lm_fit)), estimate)[1]), big.mark=",", nsmall=0, scientific=FALSE)` for 0 square feet, and that
273+
start at \$`r format(round(pull(tidy(extract_fit_parsnip(lm_fit)), estimate)[1]), big.mark=",", nsmall=0, scientific=FALSE)` for 0 square feet, and that
274274
every extra square foot increases the cost of
275-
the house by \$`r format(round(pull(tidy(pull_workflow_fit(lm_fit)), estimate)[2]), scientific=FALSE)`. Finally,
275+
the house by \$`r format(round(pull(tidy(extract_fit_parsnip(lm_fit)), estimate)[2]), scientific=FALSE)`. Finally,
276276
we predict on the test data set to assess how well our model does:
277277

278278
```{r 08-assessFinal}
@@ -314,12 +314,12 @@ lm_plot_final
314314

315315
We can extract the coefficients from our model by accessing the
316316
fit object that is output by the `fit` \index{tidymodels!fit} function; we first have to extract
317-
it from the workflow using the `pull_workflow_fit` function, and then apply
317+
it from the workflow using the `extract_fit_parsnip` function, and then apply
318318
the `tidy` function to convert the result into a data frame:
319319

320320
```{r 08-lm-get-coeffs}
321321
coeffs <- lm_fit |>
322-
pull_workflow_fit() |>
322+
extract_fit_parsnip() |>
323323
tidy()
324324
325325
coeffs
@@ -550,7 +550,7 @@ as shown below:
550550

551551
```{r 08-lm-multi-get-coeffs}
552552
mcoeffs <- mlm_fit |>
553-
pull_workflow_fit() |>
553+
extract_fit_parsnip() |>
554554
tidy()
555555
556556
mcoeffs
@@ -728,7 +728,7 @@ lm_fit1 <- workflow() |>
728728
add_model(lm_spec) |>
729729
fit(data = sacramento_train)
730730
731-
coeffs <- tidy(pull_workflow_fit(lm_fit1))
731+
coeffs <- tidy(extract_fit_parsnip(lm_fit1))
732732
733733
icept1 <- format(round(coeffs |>
734734
filter(term == "(Intercept)") |>
@@ -750,7 +750,7 @@ lm_fit2 <- workflow() |>
750750
add_model(lm_spec) |>
751751
fit(data = sacramento_train)
752752
753-
coeffs <- tidy(pull_workflow_fit(lm_fit2))
753+
coeffs <- tidy(extract_fit_parsnip(lm_fit2))
754754
icept2 <- format(round(coeffs |>
755755
filter(term == "(Intercept)") |>
756756
pull(estimate)),
@@ -771,7 +771,7 @@ lm_fit3 <- workflow() |>
771771
add_model(lm_spec) |>
772772
fit(data = sacramento_train)
773773
774-
coeffs <- tidy(pull_workflow_fit(lm_fit3))
774+
coeffs <- tidy(extract_fit_parsnip(lm_fit3))
775775
icept3 <- format(round(coeffs |>
776776
filter(term == "(Intercept)") |>
777777
pull(estimate)),

0 commit comments

Comments
 (0)