DAT8 Course Repository
Course materials for General Assembly’s Data Science course in Washington, DC (8/18/15 - 10/29/15).
Instructor: Kevin Markham (Data School blog, email newsletter, YouTube channel)

Python Resources
Class 1: Introduction to Data Science
Homework:
- Work through GA’s friendly command line tutorial using Terminal (Linux/Mac) or Git Bash (Windows).
- Read through this command line reference, and complete the pre-class exercise at the bottom. (There’s nothing you need to submit once you’re done.)
- Watch videos 1 through 8 (21 minutes) of Introduction to Git and GitHub, or read sections 1.1 through 2.2 of Pro Git.
- If your laptop has any setup issues, please work with us to resolve them by Thursday. If your laptop has not yet been checked, you should come early on Thursday, or just walk through the setup checklist yourself (and let us know you have done so).
Resources:
Class 2: Command Line and Version Control
- Slack tour
- Review the command line pre-class exercise (code)
- Git and GitHub (slides)
- Intermediate command line
Homework:
- Complete the command line homework assignment with the Chipotle data.
- Review the code from the beginner and intermediate Python workshops. If you don’t feel comfortable with any of the content (excluding the “requests” and “APIs” sections), you should spend some time this weekend practicing Python:
- Introduction to Python does a great job explaining Python essentials and includes tons of example code.
- If you like learning from a book, Python for Informatics has useful chapters on strings, lists, and dictionaries.
- If you prefer interactive exercises, try these lessons from Codecademy: “Python Lists and Dictionaries” and “A Day at the Supermarket”.
- If you have more time, try missions 2 and 3 from DataQuest’s Learning Python course.
- If you’ve already mastered these topics and want more of a challenge, try solving Python Challenge number 1 (decoding a message) and send me your code in Slack.
- To give you a framework for thinking about your project, watch What is machine learning, and how does it work? (10 minutes). (This is the IPython notebook shown in the video.) Alternatively, read A Visual Introduction to Machine Learning, which focuses on a specific machine learning model called decision trees.
- Optional: Browse through some more example student projects, which may help to inspire your own project!
Git and Markdown Resources:
- Pro Git is an excellent book for learning Git. Read the first two chapters to gain a deeper understanding of version control and basic commands.
- If you want to practice a lot of Git (and learn many more commands), Git Immersion looks promising.
- If you want to understand how to contribute on GitHub, you first have to understand forks and pull requests.
- GitRef is my favorite reference guide for Git commands, and Git quick reference for beginners is a shorter guide with commands grouped by workflow.
- Cracking the Code to GitHub’s Growth explains why GitHub is so popular among developers.
- Markdown Cheatsheet provides a thorough set of Markdown examples with concise explanations. GitHub’s Mastering Markdown is a simpler and more attractive guide, but is less comprehensive.
Command Line Resources:
- If you want to go much deeper into the command line, Data Science at the Command Line is a great book. The companion website provides installation instructions for a “data science toolbox” (a virtual machine with many more command line tools), as well as a long reference guide to popular command line tools.
- If you want to do more at the command line with CSV files, try out csvkit, which can be installed via
pip.
Class 3: Data Reading and Cleaning
- Git and GitHub assorted tips (slides)
- Review command line homework (solution)
- Python:
- Spyder interface
- Looping exercise
- Lesson on file reading with airline safety data (code, data, article)
- Data cleaning exercise
- Walkthrough of Python homework with Chipotle data (code, data, article)
Homework:
- Complete the Python homework assignment with the Chipotle data, add a commented Python script to your GitHub repo, and submit a link using the homework submission form. You have until Tuesday (9/1) to complete this assignment. (Note: Pandas, which is covered in class 4, should not be used for this assignment.)
Resources:
Class 4: Exploratory Data Analysis
- Pandas (code):
- Project question exercise
Homework:
Resources:
Class 5: Visualization
Homework:
- Your project question write-up is due on Thursday.
- Complete the Pandas homework assignment with the IMDb data. You have until Tuesday (9/8) to complete this assignment.
- If you’re not using Anaconda, install the Jupyter Notebook (formerly known as the IPython Notebook) using
pip. (The Jupyter or IPython Notebook is included with Anaconda.)
Pandas Resources:
- To learn more Pandas, read this three-part tutorial, or review these two excellent (but extremely long) notebooks on Pandas: introduction and data wrangling.
- If you want to go really deep into Pandas (and NumPy), read the book Python for Data Analysis, written by the creator of Pandas.
- This notebook demonstrates the different types of joins in Pandas, for when you need to figure out how to merge two DataFrames.
- This is a nice, short tutorial on pivot tables in Pandas.
- For working with geospatial data in Python, GeoPandas looks promising. This tutorial uses GeoPandas (and scikit-learn) to build a “linguistic street map” of Singapore.
Visualization Resources:
- Watch Look at Your Data (18 minutes) for an excellent example of why visualization is useful for understanding your data.
- For more on Pandas plotting, read this notebook or the visualization page from the official Pandas documentation.
- To learn how to customize your plots further, browse through this notebook on matplotlib or this similar notebook.
- Read Overview of Python Visualization Tools for a useful comparison of Matplotlib, Pandas, Seaborn, ggplot, Bokeh, Pygal, and Plotly.
- To explore different types of visualizations and when to use them, Choosing a Good Chart and The Graphic Continuum are nice one-page references, and the interactive R Graph Catalog has handy filtering capabilities.
- This PowerPoint presentation from Columbia’s Data Mining class contains lots of good advice for properly using different types of visualizations.
- Harvard’s Data Science course includes an excellent lecture on Visualization Goals, Data Types, and Statistical Graphs (83 minutes), for which the slides are also available.
Class 6: Machine Learning
- Part 2 of Visualization with Pandas and Matplotlib (notebook)
- Brief introduction to the Jupyter/IPython Notebook
- “Human learning” exercise:
- Introduction to machine learning (slides)
Homework:
- Optional: Complete the bonus exercise listed in the human learning notebook. It will take the place of any one homework you miss, past or future! This is due on Tuesday (9/8).
- If you’re not using Anaconda, install requests and Beautiful Soup 4 using
pip. (Both of these packages are included with Anaconda.)
Machine Learning Resources:
- For a very quick summary of the key points about machine learning, watch What is machine learning, and how does it work? (10 minutes) or read the associated notebook.
- For a more in-depth introduction to machine learning, read section 2.1 (14 pages) of Hastie and Tibshirani’s excellent book, An Introduction to Statistical Learning. (It’s a free PDF download!)
- The Learning Paradigms video (13 minutes) from Caltech’s Learning From Data course provides a nice comparison of supervised versus unsupervised learning, as well as an introduction to “reinforcement learning”.
- Real-World Active Learning is a readable and thorough introduction to “active learning”, a variation of machine learning in which humans label only the most “important” observations.
- For a preview of some of the machine learning content we will cover during the course, read Sebastian Raschka’s overview of the supervised learning process.
- Data Science, Machine Learning, and Statistics: What is in a Name? discusses the differences between these (and other) terms.
- The Emoji Translation Project is a really fun application of machine learning.
- Look up the characteristics of your zip code, and then read about the 67 distinct segments in detail.
IPython Notebook Resources:
Class 7: Getting Data
- Pandas homework with the IMDb data due (solution)
- Optional “human learning” exercise with the iris data due (solution)
- APIs (code)
- Web scraping (code)
Homework:
- Optional: Complete the homework exercise listed in the web scraping code. It will take the place of any one homework you miss, past or future! This is due on Tuesday (9/15).
- Optional: If you’re not using Anaconda, install Seaborn using
pip. If you’re using Anaconda, install Seaborn by running conda install seaborn at the command line. (Note that some students in past courses have had problems with Anaconda after installing Seaborn.)
API Resources:
- This Python script to query the U.S. Census API was created by a former DAT student. It’s a bit more complicated than the example we used in class, it’s very well commented, and it may provide a useful framework for writing your own code to query APIs.
- Mashape and Apigee allow you to explore tons of different APIs. Alternatively, a Python API wrapper is available for many popular APIs.
- The Data Science Toolkit is a collection of location-based and text-related APIs.
- API Integration in Python provides a very readable introduction to REST APIs.
- Microsoft’s Face Detection API, which powers How-Old.net, is a great example of how a machine learning API can be leveraged to produce a compelling web application.
Web Scraping Resources:
- The Beautiful Soup documentation is incredibly thorough, but is hard to use as a reference guide. However, the section on specifying a parser may be helpful if Beautiful Soup appears to be parsing a page incorrectly.
- For more Beautiful Soup examples and tutorials, see Web Scraping 101 with Python, a former DAT student’s well-commented notebook on scraping Craigslist, this notebook from Stanford’s Text As Data course, and this notebook and associated video from Harvard’s Data Science course.
- For a much longer web scraping tutorial covering Beautiful Soup, lxml, XPath, and Selenium, watch Web Scraping with Python (3 hours 23 minutes) from PyCon 2014. The slides and code are also available.
- For more complex web scraping projects, Scrapy is a popular application framework that works with Python. It has excellent documentation, and here’s a tutorial with detailed slides and code.
- robotstxt.org has a concise explanation of how to write (and read) the
robots.txt file.
- import.io and Kimono claim to allow you to scrape websites without writing any code.
- How a Math Genius Hacked OkCupid to Find True Love and How Netflix Reverse Engineered Hollywood are two fun examples of how web scraping has been used to build interesting datasets.
Class 8: K-Nearest Neighbors
Homework:
KNN Resources:
Seaborn Resources:
Class 9: Basic Model Evaluation
Homework:
Model Evaluation Resources:
Reproducibility Resources:
Class 10: Linear Regression
Homework:
- Your first project presentation is on Tuesday (9/22)! Please submit a link to your project repository (with slides, code, data, and visualizations) by 6pm on Tuesday.
- Complete the homework assignment with the Yelp data. This is due on Thursday (9/24).
Linear Regression Resources:
- To go much more in-depth on linear regression, read Chapter 3 of An Introduction to Statistical Learning. Alternatively, watch the related videos or read my quick reference guide to the key points in that chapter.
- This introduction to linear regression is more detailed and mathematically thorough, and includes lots of good advice.
- This is a relatively quick post on the assumptions of linear regression.
- Setosa has an interactive visualization of linear regression.
- For a brief introduction to confidence intervals, hypothesis testing, p-values, and R-squared, as well as a comparison between scikit-learn code and Statsmodels code, read my DAT7 lesson on linear regression.
- Here is a useful explanation of confidence intervals from Quora.
- Hypothesis Testing: The Basics provides a nice overview of the topic, and John Rauser’s talk on Statistics Without the Agonizing Pain (12 minutes) gives a great explanation of how the null hypothesis is rejected.
- Earlier this year, a major scientific journal banned the use of p-values:
- Scientific American has a nice summary of the ban.
- This response to the ban in Nature argues that “decisions that are made earlier in data analysis have a much greater impact on results”.
- Andrew Gelman has a readable paper in which he argues that "it’s easy to find a p
README 内容过长,已截取前 64 KB。完整内容请前往 GitHub 仓库查看。
评论