Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify vignettes and articles to match tidy formatting #224

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 8 additions & 6 deletions vignettes/articles/workflowsets.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ library(purrr)
library(ggplot2)
```

In this example, we'll again make use of the `tree_frogs` data exported with `stacks`, giving experimental results on hatching behavior of red-eyed tree frog embryos!
In this example, we'll again make use of the `tree_frogs` data exported with stacks, giving experimental results on hatching behavior of red-eyed tree frog embryos!

Red-eyed tree frog (RETF) embryos can hatch earlier than their normal 7ish days if they detect potential predator threat. Researchers wanted to determine how, and when, these tree frog embryos were able to detect stimulus from their environment. To do so, they subjected the embryos at varying developmental stages to "predator stimulus" by jiggling the embryos with a blunt probe. Beforehand, though some of the embryos were treated with gentamicin, a compound that knocks out their lateral line (a sensory organ.) Researcher Julie Jung and her crew found that these factors inform whether an embryo hatches prematurely or not!

We'll start out with predicting `latency` (i.e. time to hatch) based on other attributes. We'll need to filter out NAs (i.e. cases where the embryo did not hatch) first.
We'll start out with predicting `latency` (i.e., time to hatch) based on other attributes. We'll need to filter out NAs (i.e., cases where the embryo did not hatch) first.

```{r, message = FALSE, warning = FALSE}
data("tree_frogs")
Expand Down Expand Up @@ -196,7 +196,7 @@ svm_rec <-
step_normalize(all_numeric_predictors())
```

With each model specification and accompanying recipe now defined, we can combine them via `workflow_set`:
With each model specification and accompanying recipe now defined, we can combine them via `workflow_set()`:

```{r}
wf_set <-
Expand Down Expand Up @@ -303,9 +303,11 @@ Juxtaposing the predictions with the true data:

```{r, fig.alt = "A ggplot scatterplot showing observed versus predicted latency values. While there is indeed a positive and roughly linear relationship, there is certainly patterned structure in the residuals."}
ggplot(tree_frogs_test) +
aes(x = latency,
y = .pred) +
geom_point() +
aes(
x = latency,
y = .pred
) +
geom_point() +
coord_obs_pred()
```

Expand Down
10 changes: 6 additions & 4 deletions vignettes/basics.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ In this example, we'll make use of the `tree_frogs` data exported with `stacks`,

Red-eyed tree frog (RETF) embryos can hatch earlier than their normal 7ish days if they detect potential predator threat. Researchers wanted to determine how, and when, these tree frog embryos were able to detect stimulus from their environment. To do so, they subjected the embryos at varying developmental stages to "predator stimulus" by jiggling the embryos with a blunt probe. Beforehand, though some of the embryos were treated with gentamicin, a compound that knocks out their lateral line (a sensory organ.) Researcher Julie Jung and her crew found that these factors inform whether an embryo hatches prematurely or not!

We'll start out with predicting `latency` (i.e. time to hatch) based on other attributes. We'll need to filter out NAs (i.e. cases where the embryo did not hatch) first.
We'll start out with predicting `latency` (i.e., time to hatch) based on other attributes. We'll need to filter out NAs (i.e., cases where the embryo did not hatch) first.

```{r, message = FALSE, warning = FALSE}
data("tree_frogs")
Expand Down Expand Up @@ -385,9 +385,11 @@ Juxtaposing the predictions with the true data:

```{r, fig.alt = "A ggplot scatterplot showing observed versus predicted latency values. While there is indeed a positive and roughly linear relationship, there is certainly patterned structure in the residuals."}
ggplot(tree_frogs_test) +
aes(x = latency,
y = .pred) +
geom_point() +
aes(
x = latency,
y = .pred
) +
geom_point() +
coord_obs_pred()
```

Expand Down
8 changes: 5 additions & 3 deletions vignettes/classification.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ theme_set(theme_bw())
ggplot(tree_frogs) +
aes(x = treatment, y = age, color = reflex) +
geom_jitter() +
labs(y = "Embryo Age (s)",
x = "treatment",
color = "Response")
labs(
y = "Embryo Age (s)",
x = "treatment",
color = "Response"
)
```

It looks like the embryo age is pretty effective at picking out embryos with full VOR function, but the problem gets tougher for the less developed embryos! Let's see how well the stacked ensemble can classify these tree frogs.
Expand Down
Loading