Skip to content

Commit

Permalink
Minor bug fixes to episode 3 (#109)
Browse files Browse the repository at this point in the history
* cor_mat Heatmap fix

Displaying error "a matrix like object is required as argument to col on website"
Proposed fix: remove cols argument redundancy

* fix syntax in vfold_cv

repetitions -> repeats

* Load ComplexHeatmap package for Heatmaps in episode 3

* remove prep from recipe in tidymodels example

I'm not sure you can use prep in the recipe and set training data and then use the recipe in a workflow. To reproduce, issue evident when running the epsiode code in isolation.
  • Loading branch information
mallewellyn authored Feb 21, 2024
1 parent c5c7ea8 commit 9db5aab
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions _episodes_rmd/03-regression-regularisation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ than observations.
> visualise patterns when there are too many features!).
>
> ```{r corr-mat-meth, fig.cap="Cap", fig.alt="Alt"}
library("ComplexHeatmap")
> small <- methyl_mat[, 1:500]
> cor_mat <- cor(small)
> Heatmap(cor_mat,
> column_title = "Feature-feature correlation in methylation data",
> name = "Pearson correlation",
> col = col,
> show_row_dend = FALSE, show_column_dend = FALSE,
> show_row_names = FALSE, show_column_names = FALSE
> )
Expand Down Expand Up @@ -1049,8 +1049,7 @@ plot_elastic(0.75)
> update_role(age, new_role = "outcome") %>%
> ## center and scale all the predictors
> step_center(all_predictors()) %>%
> step_scale(all_predictors()) %>%
> prep(training = training(split_data), retain = TRUE)
> step_scale(all_predictors())
>
> ## set the "engine" to be a linear model with tunable alpha and lambda
> glmnet_model <- linear_reg(penalty = tune(), mixture = tune()) %>%
Expand All @@ -1062,7 +1061,7 @@ plot_elastic(0.75)
> add_model(glmnet_model)
>
> ## 5-fold cross-validation repeated 5 times
> folds <- vfold_cv(training(split_data), v = 5, repetitions = 5)
> folds <- vfold_cv(training(split_data), v = 5, repeats = 5)
>
> ## define a grid of lambda and alpha parameters to search
> glmn_set <- parameters(
Expand Down

0 comments on commit 9db5aab

Please sign in to comment.