class: title-slide, left, middle background-image: url("img/warning.jpg") background-size: contain background-position: right background-color: #F9F8F3 .pull-left[ # Tidy your mental models ### Alison Hill, Ph.D. ### AI Strategy & Innovation @IBM ### 2022-01-25 ] --- class: middle, center, inverse ## .big-text[Hello.] --- name: hello class: middle, center, inverse ### Alison Hill <img style="border-radius: 50%;" src="img/mint_disney.jpg" width="200px"/> ### Senior Data Scientist ### AI Strategy & Innovation @IBM [
@apreshill](https://github.com/apreshill) [
@apreshill](https://twitter.com/apreshill) [
apreshill.com](https://www.apreshill.com) --- background-image: url(img/dragons-1.jpg) background-size: cover --- background-image: url(img/dragons-2.jpg) background-size: cover --- background-image: url(img/code-1.jpg) background-size: contain background-position: right background-color: #fff --- background-image: url(img/code-2.jpg) background-size: contain background-position: right background-color: #fff --- ## Teaching tidymodels -- + [tidymodels.org](https://www.tidymodels.org/) + Società Italiana di Statistica Medica ed Epidemiologia Clinica Virtual Conference (2021) + R / Medicine Virtual Conference (2020) + Becton, Dickinson and Company, Online (2020) + Children’s Hospital of Philadelphia, Online (2020) + rstudio::conf 2020, San Francisco, CA, January 27 & 28 Training Days (2020) --- ## Timeline -- Step 1: Learn tidymodels (~2 months) -- Step 2: Design a 2-day workshop (~2 months) -- Step 3: Teach it! (December 2019) -- Step 4: Teach it again! (January 2020) -- Step 5: Develop tidymodels.org (April 2020) -- Step 6: Teaching remotely (https://www.apreshill.com/blog/2020-06-how-i-taught-tidymodels-virtually/) --- ## What is hard about learning (and teaching) tidymodels? -- + Lots of .emphasis[packages] (to `::` or not to `::`?) -- + Lots of .emphasis[models] (stats background?) -- + Lots of .emphasis[concepts] (some = code; others = invisible) -- + Lots of .emphasis[methods] (randomness + resampling) --- class: inverse, middle, center ## v1 https://www.apreshill.com/blog/2020-02-take-a-sad-script-make-it-better-tidymodels-edition/ ## 🙈🙉🙊 --- ## What worked (for me) -- + My learner personas (+ their ?) -- + Sequencing (roughly) -- + Pacing (roughly) -- + Scoping -- + Bite-sized, timed exercises ("No code chunk left blank!") -- + Switching back-and-forth between datasets (surprise!) --- background-image: url(img/table-0.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-1.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-2.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-3.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-4.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-0.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-6.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-7.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-8.jpg) background-size: contain background-color: #fff --- background-image: url(img/table-9.jpg) background-size: contain background-color: #fff --- ## Lessons learned -- + Give folks a "whole game" split-to-fit-to-tune case study at the end -- + Workflows is a dry package; use recipes to spice it up earlier -- + Cross-validation and tuning are like PB+J, so teach it like that -- + If time constrained, transition quickly from decision trees to random forests --- class: inverse, middle, center ## Visualizing models --- class: middle .pull-left[ ```r *# pick model *lm_mod <- * parsnip::linear_reg(engine = "lm") %>% * parsnip::set_mode("regression") lm_mod %>% fit(body_mass_g ~ flipper_length_mm, data = penguins) # parsnip model object # # Fit time: 5ms # # Call: # stats::lm(formula = body_mass_g ~ flipper_length_mm, data = data) # # Coefficients: # (Intercept) flipper_length_mm # -5872.09 50.15 ``` ] .pull-right[ <img src="index_files/figure-html/penguins-lm-1.png" width="504" style="display: block; margin: auto;" /> ] --- class: middle .pull-left[ ```r *# pick model *rt_mod <- * parsnip::decision_tree(engine = "rpart") %>% * parsnip::set_mode("regression") rt_mod %>% fit(body_mass_g ~ flipper_length_mm, data = penguins) # parsnip model object # # Fit time: 5ms # n= 333 # # node), split, n, deviance, yval # * denotes terminal node # # 1) root 333 215259700 4207.057 # 2) flipper_length_mm< 206.5 208 38996800 3702.524 # 4) flipper_length_mm< 193.5 129 19162970 3555.039 * # 5) flipper_length_mm>=193.5 79 12445890 3943.354 * # 3) flipper_length_mm>=206.5 125 35211680 5046.600 # 6) flipper_length_mm< 214.5 49 8152398 4614.796 * # 7) flipper_length_mm>=214.5 76 12032500 5325.000 # 14) flipper_length_mm< 220.5 41 5359848 5134.756 * # 15) flipper_length_mm>=220.5 35 3450464 5547.857 * ``` ] -- .pull-right[ <img src="index_files/figure-html/penguins-rt-1.png" width="504" style="display: block; margin: auto;" /> ] --- <img src="index_files/figure-html/unnamed-chunk-4-1.png" width="504" style="display: block; margin: auto;" /> --- <img src="index_files/figure-html/unnamed-chunk-5-1.png" width="504" style="display: block; margin: auto;" /> --- class: inverse, middle, center ## Visualizing concepts --- class: middle, center background-color: #fff <img src="index_files/figure-html/all-split-1.png" width="864" style="display: block; margin: auto;" /> --- exclude: true --- class: middle, center background-color: #fff -- <img src="index_files/figure-html/unnamed-chunk-7-1.png" width="720" style="display: block; margin: auto;" /> -- <img src="index_files/figure-html/unnamed-chunk-8-1.png" width="720" style="display: block; margin: auto;" /> -- <img src="index_files/figure-html/unnamed-chunk-9-1.png" width="720" style="display: block; margin: auto;" /> -- <img src="index_files/figure-html/unnamed-chunk-10-1.png" width="720" style="display: block; margin: auto;" /> -- <img src="index_files/figure-html/unnamed-chunk-11-1.png" width="720" style="display: block; margin: auto;" /> -- <img src="index_files/figure-html/unnamed-chunk-12-1.png" width="720" style="display: block; margin: auto;" /> -- <img src="index_files/figure-html/unnamed-chunk-13-1.png" width="720" style="display: block; margin: auto;" /> -- <img src="index_files/figure-html/unnamed-chunk-14-1.png" width="720" style="display: block; margin: auto;" /> --- background-image: url(img/cross-validation/Slide2.png) background-size: contain --- background-image: url(img/cross-validation/Slide3.png) background-size: contain --- background-image: url(img/cross-validation/Slide4.png) background-size: contain --- background-image: url(img/cross-validation/Slide5.png) background-size: contain --- background-image: url(img/cross-validation/Slide6.png) background-size: contain --- background-image: url(img/cross-validation/Slide7.png) background-size: contain --- background-image: url(img/cross-validation/Slide8.png) background-size: contain --- background-image: url(img/cross-validation/Slide9.png) background-size: contain --- background-image: url(img/cross-validation/Slide10.png) background-size: contain --- background-image: url(img/cross-validation/Slide11.png) background-size: contain --- exclude: true --- background-color: #fff <img src="index_files/figure-html/vfold-tiles-1.png" width="864" style="display: block; margin: auto;" /> --- background-color: #fff <img src="index_files/figure-html/unnamed-chunk-15-1.png" width="864" style="display: block; margin: auto;" /> --- name: goodbye class: bottom background-color: #b5efdd .pull-right[ .right[ <img src="img/mint_disney.jpg" width="200px"> # Thank you! ### Find me at... [
@apreshill](http://twitter.com/apreshill) [
@apreshill](http://github.com/apreshill) [
apreshill.com](https://apreshill.com) ] ]