DSCI 100 Week 5 : Version control

Sky (Kehan) Sheng

🏠 Housekeeping: Project

  • If you completed your tutorials and worksheets in time but received a grade of 0 and believe this is an error, please email Julia at
  • The course project starts this week!
  • No tutorial assignment on version control this week.
  • Instead, work on your project and complete up to Checkpoint A, and submit your repository URL to Canvas
  • Lecture recordings (all front row students blocked) from week 2-4 are now available on Canvas under “Media Gallery”!

🏠 Housekeeping: Midterm

Important

  • Bring a laptop. The Lockdown Browser does not work on an iPad or phone.
  • Bring your UBC ID card, we will check it during the midterm.
  • No AI-glasses or any camera, microphone, reocrding or communication devices allowed!
  • Midterm is 2 weeks from now on Thursday, Oct 22, starting at the beginning of tutorial period.
  • Closed book quiz on Canvas.
  • You get a reference sheet of R functions. Practise with it now, so you know where everything is.
  • You need to install the Lockdown Browser. More information to come.
  • Test out the lockdown browser on Canvas by completing the iphone_poll quiz.

Thank you for your feedback from last week!

Major feedback What I will do
Which function do I use, and when? More depth, explination and examples
  • More examples and walkthroughs will be included in class.
  • iClicker questions are updated, and ask you to pick the right function for different scenarios.
I get an error and I do not know what I did wrong.
  • I will explain common error messages during the live coding demo.
  • For the ones we do not cover, come to office hours or post on Piazza.
Can we get tutorials back sooner?
  • We will aim to release the grade within 1 week after submission.
Walk through common mistakes in assignments
  • I have asked the TAs to go through common mistakes in tutorial sessions. I will discuss them in lecture too.
  • Common error messages in the cheatsheet.
Sky’s office hour clashes with my class. Online OH option?
  • My office hours are now hybrid, with a Zoom option.
  • Check Canvas for the details.
Summary of all functions?
Tell us the goal before the new material.
  • Every lecture opens with learning objectives.
The use of AI images: mixed feedback.
  • I will cut back on the images that are only decorative.
  • Every AI image is credited in the slide footer.
  • I will keep the ones that help explain a complicated concept, because a picture is worth a thousand words.
  • Happy to chat more about this one to one!

Office Hours of all instructors and TAs

Tutorial 1 and 2: common mistakes

🚨 Relationship between two variables: needs both direction and strength

  • Direction is the tilt. Strength is how closely the points hug that tilt. An answer needs both.
  • For “no relationship”, we do not say if it’s “strong” or “weak”.
  • Points can follow a curve instead of a straight tilt: a non-linear relationship. Draw a curve for it, not a straight line.

🚨 Which variable goes on the y axis?

Our goal is to determine if there is a relationship between temperature and the number of people renting bikes.

  • Which one could be influencing the other? Warm weather changes how many people rent a bike. The riders cannot change the weather.
  • So the question is really: how does the number of rentals change as the temperature rises?
  • The variable we want to see the effect on goes on the y axis. Rentals on y, temperature on x.

🚨 Read the question description carefully

  • Two questions, and the second one sits below the code hint. Count the question marks before you move on.
  • Write your answer in the designated answer box.

🚨 Correlation is not causation!

Just because two things happen at the same time does not mean one causes the other.

🔁 Week 4 Recap: Effective data visualization

iClicker: Identify the correct visualization

🗺️ When do we use which plot?

Plot Use it to show Example from the question geom
Scatter the relationship between two quantitative variables firefighters vs. cost of damage geom_point()
Line how one quantitative variable changes over time monthly profit over five years geom_line()
Bar amounts compared across groups (categories) enrolments in five faculties geom_bar(stat = "identity")
Histogram how one quantitative variable is spread out Vancouver house values geom_histogram()

Week 5: Version control

🎯 Today’s Learning Objectives

By the end of today, you will be able to:

  • Understand the importance of version control and how it works.
  • Tell Git and GitHub apart.
  • Know how to add, commit, push and pull changes, and create a local copy or a remote repository.
  • Set up your own project repository!

🤔 Which file should Sky hand in?

Sky’s project folder, the night before the deadline:

📁 dsci100_project/
   project_report.ipynb
   project_report_final.ipynb
   project_report_final_v2.ipynb
   project_report_final_v2_Sam_edits.ipynb
   project_report_FINAL_really.ipynb
   project_report_FINAL_FINAL.ipynb
   project_report_FINAL_FINAL_FINAL.ipynb
   project_report_FINAL_really (1).ipynb
  • Which one is the newest? 🤯
  • Who changed what, and when?
  • Your plot worked yesterday and broke today. How do you get yesterday back?

📧 Just email it to your team?

☁️ OK, a shared Google Drive then?

Question 📧 Email ☁️ Google Drive
Which version is the newest? ❌ ✅
Who changed what, and when? ❌ ⚠️
Why was it changed? ❌ ❌
Go back to a version that worked ❌ ⚠️
What does each column name mean? ❌ ❌
Organize discussed to-do items and bugs ❌ ❌

✏️ What is version control?

  • Every time you reach a good point, take a snapshot of your project.
  • Each snapshot records: what changed, who changed it, when, and a short message saying why.

✏️ What is version control?

  • You can look at any old version, and go back to it (yeah time travel!)
  • Two people edited the same line? It helps you sort that out.

version control: keeping a record of every change to your files.

Made for software, now used everywhere, from data analysis to writing. These slides is under version control too.

🧰 Two tools: Git and GitHub

Git: is a version control system on your computer. It’s like the camera and photo album stored on your computer.

  • Tracks changes to files in a repository: a folder you tell Git to pay attention to
  • Keeps every snapshot in a hidden .git folder
  • Works without internet
  • Handles conflict resolution
  • Runs on your and your teammates’ computers

GitHub: a cloud-based service that keeps a shared copy of your repository online

  • Lets your teammates get your snapshots, and you get theirs
  • Handles permission: Controls who can see and who can edit
  • Has a tab called “Issues” to support project-specific communications: a to-do list and discussion board for the project
  • Can be used to build and host websites/blogs (e.g. this slide’s website)

iClicker: Git or GitHub?

📸 add, commit, push, pull

📸 Where your work lives

iClicker: Send your changes to GitHub

⏪ Time travel through your history

Three months later, your plot looks wrong. With lazy messages, which commit do you go back to?

Git clone: create a local copy of the remote repository on GitHub

Before you can add, commit, push or pull, you need the repository on your computer.

  • clone: copy a repository from GitHub to your computer, with its full history and the address of GitHub.
  • Do it once per computer. After that, use pull to get new snapshots.
  • ⚠️ Download ZIP is not the same: you get the files, but no history and no link back to GitHub, so you can’t push.

📋 Your course project

Here are the instructions for the course project: Course Project, also in the menu at the top of this site.

iClicker: Which Git step?

🗺️ Today in one table

Git terminology What it does From → to
repository a folder Git watches
clone copy a repository from GitHub, once GitHub → local computer
add choose changes for the next snapshot local computer → staging area
commit save a snapshot with a message staging area → .git
push send your snapshots to GitHub .git → GitHub
pull get new snapshots from GitHub GitHub → .git and local computer
personal access token the password GitHub wants when you push

📅 Upcoming Due Dates

  • worksheet_version_control due SATURDAY, Oct 10, 11:59pm
  • Project up to Checkpoint A due SATURDAY, Oct 10, 11:59pm
  • No tutorial assignment this week

Important

  • You must submit your repository URL to Canvas!
  • Test out the Lockdown Browser on Canvas by completing the iphone_poll quiz.

❓ Questions?

If not, let’s work on this week’s worksheet together.

  • Want to save these slides? Right click → Print → Save to PDF.
  • Your code and notes only save if you save as a PDF!
  • Today’s lecture recordings (all front row students blocked) will be uploaded to Canvas under “Media Gallery”!

Tip

Which function do I use? Function cheatsheet