class: center, middle, inverse, title-slide # DSCI 100: Introduction to Data Science ## A report on its initals offerings and future directions ### Tiffany Timbers & Trevor Campbell ### University of British Columbia ### 2019/11/15 (updated: 2019-11-15) --- class: middle # DSCI 100 - Introduction to Data Science *Use of data science tools to summarize, visualize, and analyze data. Sensible workflows and clear interpretations are emphasized* Links: - [UBC course calendar](https://courses.students.ubc.ca/cs/courseschedule?pname=subjarea&tname=subj-course&dept=DSCI&course=100) - [Course repository on GitHub](https://github.com/UBC-DSCI/dsci-100) --- # Design Intent <img src="https://2.bp.blogspot.com/--nwHn7d6qbk/Vs8ukMIaVmI/AAAAAAAAej8/fBg9o4i2i58/s1600/good-intentions.jpg" width="700"> --- class: middle # Design Intent 1. Introduce the types of research questions that can be addressed using Data Science 2. Teach Data Science to undergraduates in an authentic way 3. Use pedagogical best practices 4. Reduce barriers to entry and success --- # Learner Personas *primary intended audience* -- *Emily is a first year undergraduate who is thinking of becoming a data analyst after she graduates. She only has grade 12 Math. She has heard of the R programming language and knows it is used at her university in many statistics courses (which she plans to take) but never used it (or any other programming language) before. She is finding university very financially challenging and can only afford a Chrome book.* -- *secondary intended audience* *Mohammed is fourth year Biology undergraduate who plans to attend graduate school next year. His undergraduate honours thesis project requires analysis of data sets that are too big to be opened in JMP, the only data analysis software he has ever used. His thesis supervisor suggested he learn R to do the analysis. The supervisor gave him a book to read to do this, but Mohammed is having a hard time staying motivated doing this on his own without any feedback.* --- ## Our actual learners (2018/19) *Term 2* .pull-left[ <img src="img/year.png" width="250"> <img src="img/program.png" width="250"> ] .pull-right[ <img src="img/pre-confidence.png" width="800"> ] --- ## Our actual learners (2019/20) .pull-left[ <img src="img/year19-1.png" width="250"> <img src="img/prog19-1.png" width="250"> ] .pull-right[ <img src="img/year19-2.png" width="250"> <img src="img/prog19-2.png" width="250"> ] --- # Our actual learners (2019/20) .pull-left[ .center[<img src="img/yearprog19-1.png" width="1000">] ] .pull-right[ .center[<img src="img/yearprog19-2.png" width="1000">] ] --- # High-level learning goals of this course At the end of the course, students will know how to: -- - Map research/statistical questions to the appropriate type of data analysis. -- - Use modern reproducible tools (Jupyter notebooks, R, `tidyverse` & `caret` R packages) to solve classification (predicting labels), regression (predicting values) and clustering problems (identifying sub groups within the data). -- - Correctly interpret and communicate the results from predictive classification and regression, as well as clustering analysis. --- # Detailed learning goals of this course By the end of the course, students will be able to: - Read data using computation from various sources (local and remote plain text files, spreadsheets and databases) - Wrangle data from their original format into a fit-for-purpose format. - Identify the most common types of research/statistical questions and map them to the appropriate type of data analysis. - Create, and interpret, meaningful tables from wrangled data. - Create, and interpret, impactful figures from wrangled data. - Apply, and interpret the output of simple classifier and regression models. - Make and evaluate predictions using a simple classifier and a regression model. - Apply, and interpret the output of, a simple clustering algorithm. - Distinguish between in-sample prediction, out-of-sample prediction, and cross-validation. - Calculate a point estimate in the context of statistical inference and explain how that relates to the population quantity being estimated. - Accomplish all of the above using workflows and communication strategies that are sensible, clear, reproducible, and shareable. --- class: inverse, middle, center # Why? --- class: middle # Responsible Data Science Two facets to performing responsible data analysis: 1. Applying the correct analysis and interpretation for the research/statistical question being asked 👩 2. Data analysis should be reproducible and auditable 💻 --- class: center ### Mapping the question to the correct analysis & interpretation <img src="img/what_is_the_question.png" width=400> *Leek, J., Peng, R. (2015). What is the question? Science. [10.1126/science.aaa6146](https://science.sciencemag.org/content/347/6228/1314.full.pdf+html)* --- class: middle ### Reproducible and auditable data analysis Weapons of choice: .pull-left[ <img src="img/R_logo.svg" width=350> ] .pull-right[ <img src="https://jupyter.org/assets/main-logo.svg" width="250"> ] --- class: middle # Course organization and mechanics .pull-left[ - Two 90 min meetings a week (lecture + tutorial) - 3/4 flipped classroom - paperless course - ~ 60% of assessments were autograded ] .pull-right[ | Deliverable | % grade | |------------|----------| | Lecture worksheets | 5 | | Tutorial problem sets | 15 | | Group project | 20 | | Two quizzes | 40 | | Final exam | 20 | ] --- class: inverse, middle # Introduce Data Science to undergraduates in an authentic way - Practice what you preach (e.g., teaching materials & tools) - Give students many opportunities to learn and practice Data Science tools and workflows --- # Textbook/readings No modern yet accessible textbooks available that are suitable for our target learners... at least that we are aware of... -- ... so we wrote our own using the `bookdown` R package! .pull-left[ <img src="https://bookdown.org/yihui/bookdown/images/logo.png" width="150"> ] .pull-right[ **An Introduction to Data Science** by Tiffany Timbers, Trevor Campbell, Melissa Lee & Samuel Hinshaw https://ubc-dsci.github.io/introduction-to-datascience/ ] - still a work in progress (planned edits/updates happening currently) - [open source](https://github.com/UBC-DSCI/introduction-to-datascience) and licensed [CC BY 2.5 CA](https://creativecommons.org/licenses/by/2.5/ca/) --- # Lecture worksheets & tutorial homework .pull-left[ <img src="https://jupyter.org/assets/main-logo.svg" width="250"> ] .pull-right[ - Jupyter notebooks are literate code documents (mix of code and formatted text) - Markdown and LaTeX rendering during notebook editing makes formatting text easier - notebooks can be manually or autograded using an open source tool, [nbgrader](https://nbgrader.readthedocs.io/en/stable/) ] Examples of DSCI 100 worksheets: - [worksheet_01](https://github.com/UBC-DSCI/dsci-100/blob/master/materials/worksheet_01/worksheet_01.ipynb) - [worksheet_08](https://github.com/UBC-DSCI/dsci-100/blob/master/materials/worksheet_08/worksheet_08.ipynb) --- # Group project End product is a self-contained reproducible (Jupyter notebook) data analysis for a predictive classification question <img src="img/jupyter_project_screenshot.png" width="700"> --- class: inverse, middle # Use pedagogical best practices - Case studies - Practice with immediate feedback - Active learning activities --- # Case studies Each topic was taught within the context of Data Science case studies: <img src="https://d33wubrfki0l68.cloudfront.net/795c039ba2520455d833b4034befc8cf360a70ba/558a5/diagrams/data-science-explore.png" width="700"> *source: [R for Data Science](https://r4ds.had.co.nz/) by Garrett Grolemund & Hadley Wickham* --- class: middle ## Examples of current data sets - [Recreational marathon runners data](https://bmcsportsscimedrehabil.biomedcentral.com/track/pdf/10.1186/s13102-016-0052-y) - [World Happiness Report data](https://worldhappiness.report/) - [Avocado sales data]() - [Environment Canada Departure Bay maritime data]() - [Madrid Pollution data]() - [Fast food restaurant data]() - [Breast Cancer data]() - [Hand written digits data]() - [Real estate sale data]() - [Craft beer chemical data]() - [Trip advisor review data]() *We are open to adding additional data sets to this course* --- ## Data that is useful for this course A single categorical dependent/response variable and at least two quantitative independent/explanatory variables where when you plot the two explanatory variables as a scatter plot you get separation by the response variable. <img src="img/classification.png" height=400> --- ## Data that is useful for this course A single quantitative dependent/response variable and at least one quantitative independent/explanatory variable where when you plot the two variables as a scatter plot you get a somewhat linear relationship. <img src="img/regression.png" height=400> --- ## Data that is useful for this course At least two quantitative variables where when you plot them as a scatter plot you get separation into clusters. No labels are needed for the clusters,- the point is to identify sub-groupings in your data that you didn’t know existed <img src="img/clustering.png" height=400> --- # Practice with immediate feedback - autograding via nbgrader has the added advantage that students can run the test to assess if their answer is correct -- - *they also get to learn about code tests as a side-effect* -- - we used 3 types of exercises: - multiple choice questions - code & run with fill in the blanks - classic code & run --- class: middle ## Code and run examples <img src="img/cnr1.png" width="1000"> --- class: middle ## Code and run examples <img src="img/cnr2.png" width="1000"> --- class:middle # Active learning activites Most lectures and some tutorials had in-class activities, examples include: - pair/group programming challenges - tactile exercises - dance/role-playing --- ## Example pair/group programming challenge **Instructions to students:** Can petal length and width be used to separate the Iris flower species? Create an effective plot to answer this question! When you are done, share your code on the class forum. **Then bring everyone together to discuss a solution from the class forum:** <img src="img/class_activity_group_programming.png" width="550"> --- ## Example pair/group programming challenge The table layout and screens in the DSCI 100 classroom greatly facilitated these activites: <img src="https://learningspaces.ubc.ca/sites/learningspaces.ubc.ca/files/styles/room_images/public/classroom-images/ORCH%204074-3-2.JPG?itok=26VLoCsA&c=67023bb16f7f8c344c08cb93eef0f4d6" width="600"> --- ## Example tactile exercise At the beginning of a tutorial on classification of the handwritten digits data set it is very hard for students to understand how you go from images like those shown below to tabular data for k-nn classification. <img src="https://assets.digitalocean.com/articles/handwriting_tensorflow_python3/wBCHXId.png"> --- ## Example tactile exercise <img src="img/grids.png" width="500"> **Materials:** scissors, tape & printed images (above) **Exercise:** For each grid: - give each square an estimated value for pixel intensity (0 for completely white, 1 for completely black) - use the scissors to cut the printed images into rows - with tape, paste the rows together to get a single row --- ## Example of dance/role-playing To reinforce the algorithm behind Kmeans clustering: <img src="img/kmeans_materials.png" width="550"> **Set-up:** - TA's wear coloured t-shirts & students have a post it of each colour - one post-it note for each student has an asterisk (random) **Exercise:** 1. students hold up post-it with asterisk 2. TA's move the center of the students holding up the colour corresponding to their shirt 3. students look for the closest TA and update the colour of the post-it they are holding to match 4. iterate over 2 & 3 until things stop changing --- class: inverse, middle # Reducing barriers to entry and success - Gender and cultural minorities are under represented in STEM - Aim: remove as many barriers as possible for entry & success in DSCI 100 --- class: middle ## How? - Minimal pre-requisites (MATH 12) - Anonymous class discussion forum (Piazza) - Formal and public course code of conduct - **Web server to provide access to homework via the course learning management system (LMS)!** --- class: middle ## A JupyterHub server accessed via the course LMS - Did not want to rely on computer labs and/or managing student installation of course software - Students access homework and necessary software via a button inside course LMS (e.g., Canvas, EdX) --- class: center, middle # [Demonstration time!](https://canvas.ubc.ca/courses/19078) --- class: middle ## Experiment with JupyterHub yourself! The below links let you access the homework for DSCI 100 via a JupyterHub server that uses Google authentication (and therefore open to everyone): - [worksheet_01](https://cybera.syzygy.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2FUBC-DSCI%2Fdsci-100&branch=master&urlpath=tree%2Fdsci-100%2Fmaterials%2Fworksheet_01%2Fworksheet_01.ipynb) - [worksheet_08](https://cybera.syzygy.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2FUBC-DSCI%2Fdsci-100&branch=master&urlpath=tree%2Fdsci-100%2Fmaterials%2Fworksheet_08%2Fworksheet_08.ipynb) --- class: middle # Mid-course survey results *39 students completed our mid-course survey.* Students generally viewed workload and difficulty as just right. ![](img/workload_n_difficulty.png) --- class: middle # Mid-course survey results *39 students completed our mid-course survey.* Students generally gave high ratings to the technologies used, flipped classroom approach, and classroom space. ![](img/tech_n_class.png) --- class: middle # Teaching evaluations *24 students completed the teaching evaluations.* ![](img/teaching_evals.png) --- class: middle # Exit survey results *16 students completed our exit survey.* - **94%** student respondents reported they are **more interested in taking additional Data Science courses** - **69%** of students said they perceive **every topic in the course as valuable** --- class: middle # Confidence in the ability to use R .pull-left[ <img src="img/pre-confidence.png" width="800"> ] .pull-right[ <img src="img/confidence.png" width="300"> ] --- class: middle # Exit survey results .pull-left[ ### Topics reported as most valuable - Data Wrangling - Data visualization - Modelling/prediction/machine learning - Practical/hands on work with data - R programming language - Working in a group - Jupyter notebooks - Git & GitHub - Scraping data off the web ] .pull-right[ ### Topics reported as least valuable - R programming language - Git & GitHub - **Visualizing high dimensional data visualization** - Scraping data off the web ] **_bolded terms do not intersect these two lists_** --- # Lessons learned Many, but here are the big 3: -- 1. May not have enough time and learner prior knowledge & motivation to teach Git & GitHub -- 2. Assessing incoming and exiting knowledge is difficult -- 3. Have many eyeballs review autograded questions --- class: center, middle # 2019/20 Course Updates --- # Prerequisites .pull-left[ ### Current strategy Soft MATH12 prerequisite **Issues:** - confusing for non-BC students - most material isn't necessary - an artificial barrier ] -- .pull-right[ ### Proposed new strategy A list of specific prerequisite mathematical topics: - distance between points - percentages, average - basic operations, powers, roots - logarithm, exponential - equations of a line, plane ] -- .pull-right[ **Advantages:** - no confusion - students can brush up - no artificial barriers ] --- # Tools for Collaboration .center[Rather than technicalities of version control (e.g., Git/GitHub), <br/> focus on essentials of collaborative work with [Colaboratory](https://colab.research.google.com)] -- - keep track of versions and who made which edits - deal with conflicting edits - revert to old versions if things break - store & backup work to cloud for ease-of-access and redundancy -- .center[<img src="img/colab.png" width="570">] --- # Textbook .pull-left[ **More on data viz / communication:** - colorblind palettes - high-dimensional data - explaining and justifying claims </br> .center[<img src="img/colorblind.png" width="200"><img src="img/tsne.png" width="150">] .center[colorblind color palette ([via](https://mkweb.bcgsc.ca/colorblind)) </br>and t-SNE MNIST in 2D ([via](https://nlml.github.io/in-raw-numpy/in-raw-numpy-t-sne/))] ] -- .pull-right[ **Handling real-world messiness:** - missing data - scaling and transforming data - unbalanced data .center[<img src="img/unbalanced.png" width="175">] .center[data with unbalanced labels] ] -- **Also: enhanced focus on best practices in collaboration, reduced jargon** --- # Acknowledgements .pull-left[ #### DSCI 100 Development: - Paul Gustafson - Matias Salibian-Barrera - Will Welch - Nancy Heckman - Tiffany Timbers - Melissa Lee - Samuel Hinshaw - Melissa Guzman - Harmeet Gill - Ian Flores Siaca ] .pull-right[ #### DSCI 100 Infrastructure: - Ian Allison - Samuel Hinshaw - The Ha - Calvin Leung - Yuvi Pandas #### DSCI 100 Instructors: - Tiffany Timbers - Trevor Campbell ] --- class: inverse, middle, center # Questions?