Month: September 2023

Module 06: Combining Data

  1. Prepare (due Mon 10/9)
    1. Content below
    2. Canvas quizzes
  2. Peer Instructions – See on the class forum
  3. Homework (due Sun 10/15) [Link]
  4. Worked Example [Link]

Content (Slides in the Box Folder)

06.A – Summarizing Data

  1. Read Section 3.8 Aggregating and Grouping from Python Data Science Handbook.
  2. Read Section 3.9 Pivot Tables from Python Data Science Handbook.

06.B – Merging Data

  1. Read Section 3.6 Concat and Append from Python Data Science Handbook. Please note that the join_axes optional parameter mentioned in this section has been deprecated from the Pandas library, you can skip over the details on this parameter.
  2. Read Section 3.7 Merge and Join from Python Data Science Handbook
  3. Record Linkage (8 min.)
  4. Fuzzy Matching (21 min.)

Optional Supplements

Project: Proposal

Project Proposal

Due: Saturday, Oct. 14th (Grace Period Until Wednesday, Oct. 18th — on Gradescope this will say late submissions but you will not be penalized if you submit by Wednesday)

General Directions

The purpose of this document is to prepare your team for success in the course project. You should have feedback from your Initial Plan on the different research topics you have explored and are now introducing your chosen topic.  Your proposal should contain at least three parts, which we define below. In terms of length, it should be 1.5-3 pages (2 pages is typical) using standard margins (1 in.), font (11-12 pt), and line spacing (1-1.5). In addition to these three components, you should provide any additional context or information necessary to understand your vision for your project. You should convert your final document to a PDF and upload it to Gradescope under the assignment “Project Proposal” by the due date. Be sure to include your names and NetIds in your final document and use the group submission feature on Gradescope to include all of your group members in a single submission. For a demo/example proposal, please navigate to the course box folder.

The proposal is out of 100 points. Meeting basic formatting requirements is worth 40 points and will be graded as follows:

  • E (Exemplary, 40pts) – Work that meets all requirements.
  • N (Not yet, 24pts) – Does not meet all requirements.
  • U (Unassessable, 8pts) –  Missing at least one section.

Part 1: Introduction and Research Questions (20 points)

Your proposal should begin by introducing your topic in general and then defining one or more research questions. Research questions are the guiding questions you want to answer or problems you want to solve in your project. Your research question(s) should be (1) substantial, (2) feasible, and (3) relevant.

  1. Substantial research questions require more than a surface-level analysis (more than just computing basic summary statistics on readily available datasets, for example).
  2. Feasible research questions can actually be addressed by four or five team members over the course of approximately six weeks using data you can access.
  3. Relevant research questions address a subject of importance and interest within the scientific community or broader society. Additionally, we are looking for why your group believes this research project is worthwhile to your time in this course. 

You should provide a brief justification of your research question(s) with respect to each of these three points. We recommend clearly marking this section by bolding the words substantial, feasible, and relevant when you provide your justification.

Remember to review the feedback you received from your Initial Plan and decide on a topic/research questions that meet the criteria above and spark interest in your group. This is a project that you will be working on for a significant portion of the semester. 

Grading

  • E (Exemplary, 20pts) – Comprehensive introduction with clearly labeled research questions. It includes a justification for the research questions about whether they are substantial, feasible, and relevant. The justification is reasonable and clear in relevance to a CS216 project.
  • S (Satisfactory, 19pts) – Comprehensive introduction with clearly labeled research questions. It includes a justification for the research questions about whether they are substantial, feasible, and relevant. The justification is clearly missing in terms of clarity or reasonableness in relevance to a CS216 project.
  • N (Not yet, 12pts) – Incomplete introduction where the research questions or justification are missing pieces, but at least some of it is present, or the justification is clearly not reasonable.
  • U (Unassessable, 4pts) – Incomplete introduction where it is entirely missing the research questions or justification or does not demonstrate meaningful effort.

Part 2: Data Sources (20 points)

Your project should deal with real data. We provide pointers to some data sources in the Project Ideas section of the group formation post, but you are welcome and encouraged to look for your own data sources. After your introduction and research questions, your proposal should discuss the data you will use to answer your research questions. Be as specific as possible: name the datasets you will use and how you will access them or specify where you will look for the relevant datasets and why you expect to be successful in finding them. You should also briefly justify why the data you plan to obtain will be relevant and appropriate for addressing your research questions. Searching for data sources as you refine your research questions is likely to be the most time-consuming part of preparing your proposal and is crucial for a good start on your project, so do not put it off.

Grading

  • E (Exemplary, 20pts) – Origins of data or methods to acquire data are properly specified, cited, and relevant to answering the research question(s). If the data is not already available, the justification for why they expect they will have access to it soon is reasonable. (a.k.a. We are reasonably confident you’ll be able to get the data you need for your research questions.)
  • S (Satisfactory, 19pts) – Origins of data or methods to acquire data are properly specified and cited. However, the justification is not clear as to why the data is relevant to the proposed research question(s) OR the justification of why they expect they will have access to the data is not reasonable. (a.k.a. We are not entirely sure you’ll be able to get the data you need for your research questions.)
  • N (Not yet, 12pts) – Poorly specified data sources or methods to acquire data OR the justification for using that data set or the methods to acquire the data is lacking.
  • U (Unassessable, 4pts) – Data sources or methods to acquire data are missing or do not demonstrate meaningful effort.

Part 3: What Modules Are You Using? (20 points)

Your project should utilize concepts from modules we have/will cover in this course to answer your research question(s). We will assume you will use the skills you have acquired from modules 1 (Python), 2 (Numpy/Pandas), and 5 (Probability). This section should state at least 3 more modules that you will utilize for your project. Each module should have a short description of how you will use the knowledge in this module and a justification for that use. In addition, include what concepts from the module you will use and at what stage of your project you plan to mostly use this module. Potential stages include, but are not limited to: data gathering, data cleaning, data investigation, data analysis, and final report.

  • Module 3: Visualization
  • Module 4: Data Wrangling
  • Module 6: Combining Data
  • Module 7: Statistical Inference
  • Module 8: Prediction & Supervised Machine Learning
  • Module 9: Databases and SQL
  • Module 10: Deep Learning

When the proposal is due, you may have not yet learned material from some of the modules above. In this case, you should still provide the modules that are applicable with a description of what concepts you believe will be covered in this section that will be useful to answer your research question.

If you do not plan to use Python, NumPy, and pandas for your project, you must state this and explain why you are choosing not to. It is okay to use something else, like R, but keep in mind that the teaching staff may not have the skills to support you.

Grading

  • E (Exemplary, 20pts) – States at least 3 modules. For each module they provide a (1) short description of how they will use the module, (2) justification for using this module, (3) what concepts they will likely use, and (4) what stage they expect they will use it.
  • S (Satisfactory, 19pts) – States at least 3 modules, but there are some weaknesses somewhere, such as one module as 3 or more parts not well fleshed out or across all 3 modules one part is weak.
  • N (Not yet, 12pts) – States at 3 modules, but 3 or more parts are entirely missing or basically non-existent out of 12 = 4 parts X 3 modules.
  • U (Unassessable, 4pts) – Does not meet the Not Yet criteria, such as having fewer than 3 modules or missing more than 3 parts across all 12 = 4 parts X 3 modules.

Example:

Here is an example justification for Module 5, assuming the project is about creating a prediction model that classifies the data. Remember that this module is not on the list of modules to count as one of your 3, but you are welcome to include analysis using concepts from it. Note the bolding, which will help you ensure you are meeting all requirements and your grader to find them.

Module 5 Probability: We will use this module to calculate the accuracy of a baseline version of the model we will build. We will do this by considering the proportion of the label we are trying to predict, as well as taking into account some of the independent variables. Our justification is that we need a baseline accuracy to understand how good our model is. The concepts we will mainly use are the probability axioms and maybe some of Bayes or marginalization to calculate this baseline. We plan to use this module during the data analysis and final report stage.

Checklist Before You Submit:

  1. Does your proposal satisfy all general directions?
    1. 1.5-3 pages in length
    2. Standard margins (1 in.)
    3. Font size is 11-12 pt
    4. Line spacing is 1-1.5
    5. Final document is a PDF
  2. Do you have an Introduction and clearly stated Research Question(s)?
    1. Do you feel as if this part meets the requirements of E (Exemplary) or S (Satisfactory)?
  3. Have you properly specified/cited one or more specific Data Sources or methods to acquire data and justified why they are relevant to the Research Questions?
    1. Do you feel as if this part meets the requirements of E (Exemplary) or S (Satisfactory)?
  4. Did you state at least 3 Modules to be used and how, as well as a justification of which concepts will be used at specific stages of the project?
    1. Do you feel as if this part meets the requirements of E (Exemplary) or S (Satisfactory)?

Exam 1 Logistics

This post outlines what Exam 1 will be like.

Two different pieces are considered part of the exam. There’s the Practium and the in-person Exam.

Exam General Information

  • Modules covered: 2, 3, 4 (module 1 is covered in that you will be writing in Python)
  • Practice Exam – will be posted if there is time

Practicum

  • Done with 1 or 2 other students (so your team of 4 or 5 can split in half). You will submit through the group submission process on Gradescope
  • When: Wednesday, 10/4, starts 12:01am EST, ends 11:59pm EST
    • But it should only take your group around 75 minutes, but your group can take as long as you want. It must be submitted before the end of the day.
    • There is no class on this day, so your group has the time to work on this
  • It is a take-home, open book, open note, open internet, and open LLM exam.
  • Closed to any person outside of your group. So, no asking someone to do it for you or on places like stackoverflow.
  • It focuses on coding and interpreting the results of that code.
  • Consists of a Jupyter Notebook and a data set
    • Recommendation: Discuss in advance with your group how you will create the final submission and who will submit it.
  • A Canvas announcement will go out at the start of the exam with a link to the Box folder containing all the files you need.
  • The act of submitting and being part of a submission means that you are upholding the Duke community standard that you contributed equally to this submission and only talked amongst yourselves when working on it.
  • Protect the integrity of the exam and your exam submission.
    • Take your exam:
      • in a secure location where only your group can see your screen or talk to you.
      • in a place where you will not be distracted or tempted to talk to someone outside of your group.
    • Only after grades have been published for the Practicum Update can you do the following. Doing any of these before grades are published will be considered a violation of the Duke Community Standard.
      • Discuss what you did on the exam.
      • Show your solutions to students outside of your group.
      • View other solutions.
  • If you have a question during the exam, ask it as a private new message on the class forum. Or in helper hours.
    • We cannot help you debug your code. If it appears as if the notebook or autograder is not working, but it turns out to be your own code that has a bug, you will be graded according to your submission.
    • We will do our best to always have someone checking the forum. However, we cannot make promises someone will instantly answer your question.
    • The exam is tested for readability, so the wording should be straightforward.

Practicum Update

  • Your group will have the option to update your Practicum after seeing the results of your Practicum grade. If you choose to submit an update, your grade for the Practicum will be as follows:
    • Practicum (original): 15%
    • Practicum Update: 85%
  • When: Thursday 10/12 – Saturday 10/14
    • Note this is partially during Fall break
    • This is during Module 6 (which has due dates as usual despite Fall break since we plan to release Module 6 early enough that you can get it done before Fall break, plus there are late tokens)
  • It is your responsibility to work with your group to do the update.
  • For the update, you will do the following:
    • Update your original notebook as needed.
    • Add a new cell at the bottom of type MarkDown and list all of the changes you made from your original submission.
    • We may grade outside of your changes, but giving us a list will tell us what to focus on.

In-person Exam

  • When: Friday 10/6, during regular class time
  • Is in-person only
  • It is a paper exam taken during class.
  • There will be multiple versions.
  • It focuses on thinking like a data scientist and will have no coding writing.
    • It may have the results of calling the describe function on a data set, so know what that function does.
  • You may bring one piece of paper as a cheatsheet and can put things on the front and back.

Grading Scale and Points Allocation

For the questions that do not have a clear correct or incorrect answer or where partial credit is warranted, the following rubric will be used.

  • E (Exemplary) – Work that meets all requirements and displays full mastery of all learning goals and material. And the code is clean and easy to read (see the practice exam for examples of what this means).
  • S (Satisfactory) – Work that meets all requirements and displays at least partial mastery of all learning goals as well as full mastery of core learning goals.
  • N (Not yet) – Work that does not meet some requirements and/or displays developing or incomplete mastery of at least some learning goals and material.
  • U (Unassessable) – Work that is missing, does not demonstrate meaningful effort, or does not provide enough evidence to determine a level of mastery.

The number of points earned is distributed across the problems based on the number of learning goals they are testing. The rubric will be converted to points as follows:

  • E = full credit
  • S = E_full_credit – 1 or 2
  • N = E_full_credit * 0.6
  • U = E_full_credit * 0.2
  • Blank = 0

Unit tests in the autograder for the Practicum will earn you points up to, but not quite, the U level. Whether an S is 1 or 2 less points than an E depends on the exam part. Each part is out of 100 points. The goal is earning only S’s results in a low A. So, for example, if the Practicum has only 4 questions, an S would lose 2 points compared to an E, which means getting all S’s is a low A (92%), but still guarantees an A on the Practicum.

Module 05: Probability

  1. Prepare (due Mon 9/25)
    1. Content below
    2. Sakai quizzes
  2. Video of the piece that got lost from Wednesday’s class
  3. Peer Instructions – See on the class forum
  4. Homework (due Sun 10/1) [Link]
  5. Worked Examples [Link]

Content (Slides in the Box folder)

5.A – Foundations of Probability (52 min.)

  1. Outcomes, Events, Probabilities (15 min.)
  2. Joint and Conditional Probability (11 min.)
  3. Marginalization and Bayes’ Theorem (15 min.)
  4. Random Variables and Expectations (11 min.)

5.B – Distributions of Random Variables (46 min.)

  1. Distributions, Means, Variance (19 min.)
  2. Monte Carlo Simulation (15 min.)
  3. Central Limit Theorem (12 min.)
    1. Slide 26 in the video has a typo that is fixed in the pdf version of the slides on Box. In the video, it says the probability is <= 0.95, but it should say < 0.05.

Optional Supplements

Helpful YouTube videos to understand nuance with examples

Online Textbook and Documentation

You can access an excellent free online textbook on OpenIntro Statistics here, co-authored by Duke faculty. You can pay a suggested but adjustable price for a tablet-friendly pdf, but you can also just get the regular pdf for free. For this module, the following optional readings may be particularly helpful supplements:

  • Chapter 3: Probability. This provides more information on many of the topics from the above videos in Foundations of Probability.
  • Chapter 4: Distributions of random variables. This provides much more information about particular classic distributions than is provided in 2B.B.1.
  • Chapter 5.1: Point estimates and sampling variability. This provides more information on some of the topics from 2B.B.2-3.

In addition, you can find documentation for the two pseudorandom number-generating / sampling libraries in python that we mentioned here:

Module 03: Visualization

  1. Prepare (due Mon 9/16)
    1. Content below
    2. Sakai quizzes
  2. Class engagement – See on the class forum
  3. Homework (due Sun 9/22) [Link]
  4. Worked Examples [Link]

Content

03.A – Data Visualization and Design

  1. Why Visualize? (11 min.)
  2. Basic Plot Types (17 min.)
  3. Dos and Don’ts (10 min.)

03.B – Visualization in Python

  1. Intro to Python Visualization Landscape (7 min.)
  2. Seaborn Introduction (17 min.)
  3. Seaborn Examples (17 min.)

Optional Supplements

Project: Initial Plan

Project: Initial Plan

Due: Saturday, Sept. 23rd

General Directions

The purpose of this document is to ensure that your group is choosing a substantial research project topic that is interesting and worthwhile. You will be working on the collaborative final project for a large portion of this course, and will use this deliverable to brainstorm project ideas and plan how your team will collaborate. In terms of length, it should be 1-2 pages (not including the appendix) using standard margins (1 in.), font (11-12 pt), and line spacing (1-1.5). You should convert your final document to a pdf and upload it to Gradescope under the assignment “Initial Plan” by the due date. Be sure to include your names and NetIDs in your final document and use the group submission feature on Gradescope to include all of your group members on a single submission.

The Initial Plan is out of 100 points. Meeting basic formatting requirements is worth 40 points and will be graded as follows:

  • E (Exemplary, 40pts) – Work that meets all requirements.
  • N (Not yet, 24pts) – Does not meet all requirements.
  • U (Unassessable, 8pts) –  Missing at least one section.

Part 1: Brainstorming (40 points)

To brainstorm ideas for your research topic, you may use one of two options:

  1. Mind map of potential project ideas.
  2. Discussion with ChatGPT or LLM of your choice.

 

For the mind map, you can use an online tool, Google drawing, whiteboard, post-it notes, etc. Just ensure you can put it in your report. To create your mind map, use the following steps:

  1. Put a central idea or main concept in the center, such as “data science research project” or something more specific that your group finds interesting.
  2. Branch out from the main with ideas that can cover a range from interesting topics to previous project ideas that caught your group’s attention.
  3. Branch off of those ideas to add more specific interests or personalized ways you would change a topic or project.
  4. Put your mind map (if it’s on something like a physical whiteboard take a picture) as an appendix in this submission.

 

For the discussion with an LLM, do the following:

  1. Tell the LLM you are brainstorming for data science projects, what your group’s interests are that could be potential sources of data, and that you need to find the data yourself.
  2. Ask it what ideas it has for your project.
  3. Tell it what ideas you liked, didn’t like, why a suggestion isn’t a good one, etc.
  4. Do at least 2-3 rounds of steps 2 and 3 with the LLM.
  5. Put your chat as an appendix in this submission.

 

After your brainstorm, reflect by answering the following questions:

  1. Why did you choose the method you used?
  2. What patterns do you see in what you find interesting?
  3. What research topics or questions did your group generate from this brainstorming? Which of these ideas can you see your group potentially pursuing?
  4. Do you feel like more brainstorming is needed before you find a topic?
  5. If you used
    1. The mindmap: Did you find your brainstorming narrowing or diverging as you discuss ideas to write down?
    2. LLM: How satisfied were you with its answers? Why?

Whether you choose to create a mind map or use an LLM, use this exercise to brainstorm project ideas that your group collectively believes are interesting, relevant, and worthwhile to your time in this course.

Grading

  • E (Exemplary, 40pts) – Appendix has a mind map that branches out at least two levels from the center OR an LLM conversation. In addition, has a reflection that answers all 5 questions.
  • S (Satisfactory, 39pts) – Appendix has a mind map that branches out at least two levels from the center OR an LLM conversation. In addition, has a reflection that mostly answers all 5 questions.
  • N (Not yet, 24pts) –  A brainstorm that does not entirely answer 1 or 2 of the questions. Reflection does not entirely answer at least 1 of the questions.
  • U (Unassessable, 8pts) – Work that does not entirely answer 3 or more of the questions above for either the brainstorm or the reflection.

Part 2: Collaboration Plan (20 points)

This is a collaborative course project pursued by a team of students who bring different strengths and interests to the table. This reflects the reality that significant real-world projects in data science are almost always pursued by teams. For the collaboration to be successful, it helps to establish some guidelines that serve as a starting point. Your collaboration plan should address the following:

  1. How will you divide responsibilities? Will some students be responsible for certain portions of the project, or will you be more integrated and decide on responsibilities on a weekly basis?
  2. About how much time do you expect every group member to spend on the project each week, on average? It is okay if this number is higher toward the last couple of weeks of the semester.
  3. When and how will you meet? You should plan to meet at least once per week for at least 30 minutes to check in on one another’s progress, get help, and plan for what comes next. Identify a day of the week, a time, and the place/platform you will use to meet.
  4. What platform(s) will you use to communicate between meetings? Will you primarily use email, text, Slack, or other chat apps? If you want a more professional enterprise tool, Duke provides free access to Microsoft Teams.
  5. Where will you track who is doing what tasks and when those tasks will be done? This can be as simple as a Google doc with a checklist or as advanced as a Trello board. What is important is there is a clear repository of who is doing what, the status of that thing, and when it should be done.
  6. Where will you store data, code, writing, etc., so that all group members have easy access to shared materials?* Duke provides free access to Box and GitLab, which could serve these purposes, but you could also use external services like Google Drive or GitHub. Provide a link to the folder/repository in your proposal to demonstrate that it is created and ready.

* In addition to a common repository for data, you may find it useful to explore Google colab or DeepNote, which allows you to collaborate on Jupyter Notebooks and execute them in the cloud (like a Google doc for Jupyter notebooks).

Grading

  • E (Exemplary, 20pts) – Comprehensive plan that answers all 6 questions and includes a link to their folder/repository.
  • S (Satisfactory, 19pts) – Comprehensive plan that mostly answers all 6 questions. The link to their folder/repository could be missing.
  • N (Not yet, 12pts) – A plan that does not entirely answer 1 or 2 of the questions above. Link can be missing.
  • U (Unassessable, 4pts) – A plan that does not entirely answer 3 or more of the questions above.

Project: Group Formation

Due: Friday, September 8th

In place of a final exam, this course has a collaborative final project where we ask you to bring your data science skills to bear on a research project of your own choosing. To help groups without enough people (you need 4-5), you must indicate who will be in your group by filling out the group formation survey on Gradescope no later than Friday, September 8th. Use the group submission feature on Gradescope to include all of your group members on a single submission.

The survey should only take a couple of minutes. If you do not have anyone to work with or do not have sufficient people, we will assign you to a group or add more people to your group. So fill out the form so we know what your or your subgroup’s interests are.

If it is helpful to start thinking about possible project ideas, below are some project ideas. You can also brainstorm now using strategies that are outlined in the Initial Plan post (TBA). But it is not required that you have a concrete project idea until the proposal.

Project ideas

Not sure how to get started? Looking for examples of what a data science project might look like? Here are some of the topics that students studied in Spring 2020:

  • Comparing Stock Market Losses between SARS and SARS-CoV-2
  • Recessions, Depressions, and Depression: Mental Health in Relation to Economic Factors
  • Predicting North Carolina Election Outcomes
  • Relating Text Analysis of Corporate Reports and Stock Performance
  • Modeling Consumer Flight Behavior Based on Economic Indicators
  • Predicting COVID-19 Death Tolls from Google Search Trends
  • Sentiment Analysis of COVID-19 Tweets
  • Economic Status and Drug Overdose in North Carolina
  • Analyzing Gender and Tech Careers
  • Political Landscape According to Social Media
  • Forecasting Market Shocks and Performance using Article Headlines
  • Tracking Recidivism in US Prisons
  • Understanding AirBnBs impact on Evictions
  • Understanding Musical Tastes (Music Recommender System)
  • Human Impact on Climate since the Industrial Revolution
  • The Troll Toll: An Investigation into Troll Tweets

And here is an archive of summer Data+ projects from the last several years. In Data+, teams of about 4 undergraduate students collaborate over the summer on a data science project. You should be able to see final presentations and/or executive summary slides for most projects; feel free to browse for inspiration.

Example Data Sources

Below, we have some examples of datasets or where you might find data. You should work with data that is interesting to you and should feel free (strongly encouraged even) to look for sources yourself. These are listed just as possibilities and starting places.

  • Kaggle maintains several thousand public datasets of interest in a variety of topics. Kaggle also hosts several prediction challenges; one idea for a machine learning project is to enter one of these competitions as a team.
  • The Yelp Dataset is provided by Yelp as a research challenge with lots and lots of data about reviews, businesses, images, and cities – text data, rich json data, etc.
  • The University of California Irvine maintains a large UCI ML repository of publicly contributed datasets aimed toward machine learning tasks of all types. They range from small simple example datasets to large and complicated datasets from specific scientific domains.
  • Data.gov has a huge compilation of data sets produced by the US government. The US Census Bureau also publishes datasets from all of its survey work. Similarly, The Supreme Court Database tracks all cases decided by the US Supreme Court, and GovTrack.us provides links to all kinds of information about the US Congress and all votes casted by its members.
  • Duke University Library Digital Repository Research Data
  • ICPSR – An international consortium of more than 750 academic institutions and research organizations, Inter-university Consortium for Political and Social Research (ICPSR) provides leadership and training in data access, curation, and methods of analysis for the social science research community. ICPSR maintains a data archive of more than 250,000 files of research in the social and behavioral sciences. It hosts 21 specialized collections of data in education, aging, criminal justice, substance abuse, terrorism, and other fields.

Powered by WordPress & Theme by Anders Norén