class: center, middle, inverse, title-slide .title[ # WhoseEgg ] .subtitle[ ## .white[A Shiny App for Identifying Invasive Carp Using Random Forests and Fish Egg Characteristics] ] .author[ ###
] .author[ ### .white[Katherine Goode] ] .author[ ### .white[Joint work with]
Dr. Michael Weber
.white[and]
Dr. Philip Dixon
] .author[ ### .white[Presented at ISU LunchinatoRs] ] .date[ ### .white[April 16, 2021]
.small[.white[Code used to generate slides found
here
]] ] --- <script> var slideshow = remark.create({slideNumberFormat : function (current, total) { return current + '/' + (this.getSlideByName("mylastslide").getSlideIndex() + 1); }, highlightStyle: "github", highlightLines: true, countIncrementalSlides: false}); </script> <style type="text/css"> .tiny{font-size: 30%} .small{font-size: 60%} .medium{font-size: 75%} .left-code { color: #777; width: 37%; height: 92%; float: left; } .right-plot { width: 60%; float: right; padding-left: 1%; } </style> # Overview - Background on R Shiny - Project Background - WhoseEgg App <br> <center> ![](figures/jumping-carp.gif) <center> --- class: inverse, middle, center # Background on R Shiny --- # What is Shiny? Shiny lets you create apps using R! From the [Shiny website](https://shiny.rstudio.com/): > Shiny is an R package that **makes it easy to build interactive web apps straight from R**. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions. <img src="figures/shiny.png" width="35%" style="display: block; margin: auto;" /> --- # Shiny website <body> <style type="text/css"> body, html { margin: 0; padding: 0; height: 100%; overflow: hidden; } #content { position:absolute; left: 0; right: 0; bottom: 0; top: 0%; } </style> <div id="content"> <iframe width="100%" height="100%" frameborder="0" src="https://shiny.rstudio.com/"/> </div> </body> --- class: inverse, middle, center # Project Background --- # Invasive Carp - Brought to US in 1960s - Become a threat to native fish populations in Mississippi River basin - Interest in monitoring population to prevent further spread <br> <img src="figures/large-carp.JPG" width="60%" style="display: block; margin: auto;" /> --- # Egg Collection - One method for monitoring carp is to collect eggs - Common practice is to have eggs identified using genetic analysis - Expensive - Led [Camacho et al. (2019)](https://afspubs.onlinelibrary.wiley.com/doi/abs/10.1002/nafm.10380) to try using machine learning to classify fish eggs <br> .center[ <img src="figures/egg1.png" width="30%" /><img src="figures/egg2.png" width="30%" /><img src="figures/egg5.png" width="30%" /> ] --- # Machine Learning Appraoch .pull-left[ **[Camacho et al. (2019)](https://afspubs.onlinelibrary.wiley.com/doi/abs/10.1002/nafm.10380)** - Trained random forests - Predictor variables: - Egg characteristics - Responses: - Family, genus, and species - Models showed promise for identifying invasive carp ] .pull-right[ **[Goode et al. (2021)](https://afspubs.onlinelibrary.wiley.com/doi/10.1002/nafm.10616)** - Validated models using a new year of data - Trained new models with all years of data ] --- # Sampling Site and Years Three years of collection <img src="figures/map.png" width="70%" style="display: block; margin: auto;" /> --- # Egg Collection Collected eggs measured and genetically identified <img src="figures/Larval_Tow_Eggs.jpg" width="47%" style="display: block; margin: auto;" /> --- # Predictor Variables .left-code[ **Egg characteristics: ** - Month - Julian day - Water temperature - Water conductivity - Deflated? - Pigment? - Compact or diffuse? - Sticky debris? - Egg stage - Membrane average - Membrane standard deviation - Membrane coefficient of variation - Embryo average - Embryo standard deviation - Embryo coefficient of variation - Embryo to membrane ratio - Larval length ] .right-plot[ <img src="figures/egg-characteristics.png" width="100%" style="display: block; margin: auto;" /> ] --- # Response Variables .pull-left[ **Taxonomy with invasive carp categorized as one class**: - Family (8 levels) - Genus (16 levels) - Species (27 levels) ] .pull-right[ ![](figures/carp.png) <br> <small> Image source: https://www.watershedcouncil.org/asian-carp.html </small> ] --- # Validation of Original Models Metrics computed using 2014-2015 model on 2016 data <img src="figures/val-res.png" width="2700" /> --- class: inverse, middle, center # WhoseEgg App --- # WhoseEgg **Goals** - Provide a tool that is accessible to non-R users for using the random forest to predicting the identification of fish eggs - Used to help identify areas where invasive carp are reproducing - Screen eggs to select a subset to send for genetic identification <br> **Models used** - Random forests: - Trained with all three years of data - Responses of family, genus, and species with invasive carp grouped --- # App Demonstration App available at: https://whoseegg.stat.iastate.edu/ Example datasets available at: https://github.com/goodekat/presentations/blob/master/2021-lunchinatoRs-shiny-fish/example_data.zip <img src="figures/app.png" width="75%" style="display: block; margin: auto;" /> --- name: mylastslide # Possible Updates <br> - Add visualizations of input data compared to training data <br> - Include prediction intervals <br> - Add visualizations relating to explainability for individual predictions <br> - Add video showing how to use the app <br> - Add image during loading of swimming fish --- class: inverse, center <br> <br> # Thank you! <img src="figures/Skunk River larval AC.jpg" width="85%" /> --- class: inverse, center, middle # Additional Figures --- # Metrics on Training Data Models trained with 2014-2015 and 2014-2016 data <img src="figures/train-res.png" width="95%" style="display: block; margin: auto;" /> --- # Metrics on New/Old Sites <img src="figures/res-diff-sites.png" width="80%" style="display: block; margin: auto;" /> --- # Feature Importance <img src="figures/feature-imp.png" width="100%" style="display: block; margin: auto;" /> --- # Partial Dependence Plots <img src="figures/pdps.png" width="100%" style="display: block; margin: auto;" /> --- # Correlation Between Features <img src="figures/correlation.png" width="80%" style="display: block; margin: auto;" />