Course materials for General Assembly's Data Science course in Washington, DC (6/1/15 - 8/12/15).
Instructor: Kevin Markham (Data School blog, email newsletter, YouTube channel)
Monday | Wednesday |
---|---|
6/1: Introduction to Data Science | 6/3: Command Line and Version Control |
6/8: Data Reading and Cleaning | 6/10: Exploratory Data Analysis |
6/15: Visualization | 6/17: Machine Learning |
6/22: Getting Data Project Discussion Deadline |
6/24: K-Nearest Neighbors Project Question and Dataset Due |
6/29: Basic Model Evaluation | 7/1: Linear Regression |
7/6: Logistic Regression | 7/8: Advanced Model Evaluation |
7/13: First Project Presentation | 7/15: Naive Bayes and Text Data |
7/20: Natural Language Processing | 7/22: Kaggle Competition |
7/27: Decision Trees Draft Paper Due |
7/29: Ensembling |
8/3: Advanced scikit-learn and Clustering, Peer Review Due |
8/5: Course Review |
8/10: Final Project Presentation | 8/12: Final Project Presentation |
- Codecademy's Python course: Good beginner material, including tons of in-browser exercises.
- DataQuest: Similar interface to Codecademy, but focused on teaching Python in the context of data science.
- Google's Python Class: Slightly more advanced, including hours of useful lecture videos and downloadable exercises (with solutions).
- A Crash Course in Python for Scientists: Read through the Overview section for a quick introduction to Python.
- Python for Informatics: A very beginner-oriented book, with associated slides and videos.
- Beginner and intermediate workshop code: Useful for review and reference.
- Python 2.7x Reference Guide: Kevin's beginner-oriented guide that demonstrates a ton of Python concepts through short, well-commented examples.
- Python Tutor: Allows you to visualize the execution of Python code.
- Welcome from General Assembly staff
- Course overview (slides)
- Introduction to data science (slides)
- Discuss the course project
- Types of data (slides) and public data sources
- Wrap up: Slack tour, submission forms
Homework:
- Work through GA's friendly command line tutorial using Terminal (Linux/Mac) or Git Bash (Windows), and then browse through this command line reference.
- Watch videos 1 through 8 (21 minutes) of Introduction to Git and GitHub.
- If your laptop has any setup issues, please work with us to resolve them by Wednesday.
Resources:
- For a useful look at the different types of data scientists, read Analyzing the Analyzers (32 pages).
- For some thoughts on what it's like to be a data scientist, read these short posts from Win-Vector and Datascope Analytics.
- Quora has a data science topic FAQ with lots of interesting Q&A.
- Keep up with local data-related events through the Data Community DC event calendar or weekly newsletter.
- Command line exercise (code)
- Git and GitHub (slides)
- Intermediate command line
- Wrap up: Course schedule, office hours
Homework:
- Complete the homework exercise listed in the command line introduction. Create a Markdown document that includes your answers and the code you used to arrive at those answers. Add this file to a GitHub repo that you'll use for all of your coursework, and submit a link to your repo using the homework submission form.
- Review the code from the beginner and intermediate Python workshops. If you don't feel comfortable with any of the content (up through the "dictionaries" section), you should spend some time this weekend practicing Python. Here are my recommended resources:
- 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 these much longer lessons from DataQuest: "Find the US city with the lowest crime rate" and "Discover weather patterns in LA".
- If you've already mastered these topics and want more of a challenge, try solving the second Python Challenge and send me your code in Slack.
- If there are specific Python topics you want me to cover next week, send me a Slack message.
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.
- 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
.
Homework:
- Complete the homework assignment with the Chipotle data, and add a commented Python script to your GitHub repo. If you are unable to complete a part, try writing some pseudocode instead! You have until Monday to complete this assignment.
Resources:
- PEP 8 is Python's "classic" style guide, and is worth a read if you want to write readable code that is consistent with the rest of the Python community.
- Pandas (code):
Homework:
- Complete "Exercise Three" from today's Pandas script. Note: You do not need to submit this assignment.
- Read How Software in Half of NYC Cabs Generates $5.2 Million a Year in Extra Tips for an excellent example of exploratory data analysis.
Resources:
- Browsing or searching the Pandas API Reference is an excellent way to locate a function even if you don't know its exact name.
- What I do when I get a new data set as told through tweets is a fun (yet enlightening) look at the process of exploratory data analysis.
- Part 2 of Exploratory Data Analysis with Pandas (code)
- Visualization with Pandas and Matplotlib (code)
Homework:
- Complete the homework assignment with the IMDb data, and add a Python script to your GitHub repo. This assignment is due next Monday.
Pandas Resources:
- To learn more Pandas, review 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 by the creator of Pandas.
- Here are examples of different types of joins in Pandas, for when you need to figure out how to merge two DataFrames.
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.
- 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.
- Review Python homework with the Chipotle data (solution, detailed explanation)
- Grouped box plots and grouped histograms (code)
- Human learning exercise:
- Iris dataset hosted by the UCI Machine Learning Repository
- Iris photo
- Solution
- Introduction to machine learning (slides)
- Course project:
- Example projects
- Project question exercise
Homework:
- Your deadline for discussing your project ideas with an instructor is Monday, and your project question and dataset is due Wednesday.
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!)
- For a really nice comparison of supervised versus unsupervised learning, plus an introduction to reinforcement learning, watch this video (13 minutes) from Caltech's Learning From Data course.
- 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.
- 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.
Homework:
- Your project question and dataset is due on Wednesday.
- 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!
- If you're not using Anaconda, install the IPython Notebook using
pip
. (The IPython Notebook comes with Anaconda.) - If you're not using Anaconda, install Seaborn using
pip
. If you're using Anaconda, install Seaborn by runningconda install seaborn
at the command line. - Watch this brief introduction to scikit-learn and the IPython Notebook (15 minutes), and try to follow along with the Notebook introduction on your own computer.
- Read Kevin's introduction to reproducibility, read Jeff Leek's guide to creating a reproducible analysis, and watch this related Colbert Report video (8 minutes).
API Resources:
- Mashape and Apigee allow you to explore tons of different APIs. Alternatively, a Python API wrapper is available for many popular 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, Alex'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.
- Optional web scraping homework due (solution)
- Reproducibility
- Discuss assigned readings: introduction, Colbert Report video, cabs article, Tweet, creating a reproducible analysis
- Examples: Classic rock, student project 1, student project 2
- Machine learning exercise (article)
- Brief introduction to the IPython Notebook
- K-nearest neighbors and scikit-learn (notebook, notebook code)
- Exploring the bias-variance tradeoff (notebook, notebook code)
Homework:
- Reading assignment on the bias-variance tradeoff
- Browse through the scikit-learn documentation for KNN to get a sense of how it's organized: user guide, module reference, class documentation
- Work on your project... your first project presentation is in less than three weeks!
- Optional: Read the Teaching Assistant Evaluation dataset into Pandas, create the X and y objects (the response variable is "class attribute"), and go through scikit-learn's 4-step modeling process. (There's no need to submit your code unless you have a question or would like feedback!)
KNN Resources:
- For a recap of the key points about KNN and scikit-learn, watch Getting started in scikit-learn with the famous iris dataset (15 minutes) and Training a machine learning model with scikit-learn (20 minutes).
- A Detailed Introduction to KNN is a bit dense, but provides a more thorough introduction to KNN and its applications.
- This lecture on Image Classification shows how KNN could be used for detecting similar images, and also touches on topics we will cover in future classes (hyperparameter tuning and cross-validation).
- Some applications for which KNN is well-suited are object recognition, satellite image enhancement, document categorization, and gene expression analysis.
Reproducibility Resources:
- Software development skills for data scientists discusses the importance of writing functions and proper code comments (among other skills), which are highly useful for creating a reproducible analysis.
- Data science done well looks easy - and that is a big problem for data scientists explains how a reproducible analysis demonstrates all of the work that goes into proper data science.
Other Resources:
- If you would like to learn the IPython Notebook, the official Notebook tutorials are useful.
- To get started with Seaborn for visualization, the official website has a series of tutorials and an example gallery.
- Discuss the reading assignment on the bias-variance tradeoff
- Model evaluation using train/test split (notebook, notebook code)
- Glass identification exercise using scikit-learn (instructions, code)
Homework:
- Try to finish the glass identification exercise at home, and then compare your code to the solution. However, there is no need to submit your code unless you have questions or would like feedback.
- If you're brand new to linear regression, read What is Linear Regression? and watch The Easiest Introduction to Regression Analysis (14 minutes).
Resources:
- For a recap of much of today's lesson, watch Comparing machine learning models in scikit-learn (27 minutes).
- For another explanation of training error versus testing error, the bias-variance tradeoff, and train/test split (also known as the "validation set approach"), watch Hastie and Tibshirani's video on estimating prediction error (12 minutes, starting at 2:34).
- Caltech's Learning From Data course includes a fantastic video on visualizing bias and variance (15 minutes).
- Random Test/Train Split is Not Always Enough explains why random train/test split may not be a suitable model evaluation procedure if your data has a significant time element.
- Linear regression (notebook, notebook code)
Homework:
- Complete the homework assignment with the Yelp reviews data, and add a Python script (or IPython notebook) to your GitHub repo. This assignment is due on Monday.
- Watch Rahul Patwari's videos on probability (5 minutes) and odds (8 minutes) if you're not familiar with either of those terms.
- Read these excellent articles from BetterExplained: An Intuitive Guide To Exponential Functions & e and Demystifying the Natural Logarithm (ln).
Resources:
- Setosa has an excellent interactive visualization of linear regression.
- To go much more in-depth on linear regression, read Chapter 3 of An Introduction to Statistical Learning, from which this lesson was adapted. Alternatively, watch the related videos or read my quick reference guide to the key points in that chapter.
- To learn more about Statsmodels and how to interpret the output, DataRobot has some decent posts on simple linear regression and multiple linear regression.
- This introduction to linear regression is much more detailed and mathematically thorough, and includes lots of good advice.
- This is a relatively quick post on the assumptions of linear regression.
- John Rauser's talk on Statistics Without the Agonizing Pain (12 minutes) gives a great explanation of how the null hypothesis is rejected.
- A major scientific journal recently 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 < .05 comparison even if nothing is going on, if you look hard enough".
- Yelp reviews homework due (solution)
- Logistic regression (notebook, notebook code)
- Exercise with Titanic data (instructions, solution)
- Confusion matrix (slides)
Homework:
- If you aren't yet comfortable with all of the confusion matrix terminology, watch Rahul Patwari's videos on Intuitive sensitivity and specificity (9 minutes) and The tradeoff between sensitivity and specificity (13 minutes).
- Video assignment on ROC curves and AUC
Resources:
- To go deeper into logistic regression, read the first three sections of Chapter 4 of An Introduction to Statistical Learning, or watch the first three videos (30 minutes) from that chapter.
- For a math-ier explanation of logistic regression, watch the first seven videos (71 minutes) from week 3 of Andrew Ng's machine learning course, or read the related lecture notes compiled by a student.
- For more on interpreting logistic regression coefficients, read this excellent guide by UCLA's IDRE and these lecture notes from the University of New Mexico.
- The scikit-learn documentation has a nice explanation of what it means for a predicted probability to be calibrated.
- Supervised learning superstitions cheat sheet is a very nice comparison of four classifiers we cover in the course (logistic regression, decision trees, KNN, Naive Bayes) and one classifier we do not cover (Support Vector Machines).
- My simple guide to confusion matrix terminology may be useful to you as a reference.
- Advanced model evaluation (notebook, notebook code)
- Null accuracy, handling missing values
- Confusion matrix
- Handling categorical features
- ROC curves and AUC
- Discuss the video assignment
- Exercise: drawing an ROC curve (slides)
- Return to the notebook
Homework:
- Your first project presentation is on Monday! Please submit a link to your project repository (with slides, code, data, and visualizations) before class using the submission form.
ROC Resources:
- Rahul Patwari has a great video on ROC Curves (12 minutes).
- An introduction to ROC analysis is a very readable paper on the topic.
- These lesson notes from a course at the University of Georgia include some simple, real-world examples of the use of ROC curves.
- ROC curves can be used across a wide variety of applications, such as comparing different feature sets for detecting fraudulent Skype users, and comparing different classifiers on a number of popular datasets.
- This blog post about Amazon Machine Learning contains a neat graphic showing how classification threshold affects different evaluation metrics.
- This short notebook demonstrates how ROC curves and AUC are only sensitive to the rank ordering of predicted probabilities.
Other Resources:
- scikit-learn has extensive documentation on model evaluation.
- Section 3.3.1 of An Introduction to Statistical Learning (4 pages) has a great explanation of dummy encoding for categorical features.
- Project presentations!
Homework:
- Reading assignment on spam filtering
- Read these Introduction to Probability slides, or skim section 2.1 of the OpenIntro Statistics textbook (12 pages). Pay specific attention to the following terms: probability, mutually exclusive, sample space, independent.
- Optional: Try to gain an understanding of conditional probability from this visualization.
- Optional: For an intuitive introduction to Bayes' theorem, read these posts on wealth and happiness, ducks, or legos.
- Conditional probability and Bayes' theorem
- Slides (adapted from Visualizing Bayes' theorem)
- Applying Bayes' theorem to iris classification (notebook)
- Naive Bayes classification
- Slides
- Example with spam filtering (notebook)
- Discuss the reading assignment on spam filtering
- Classifying SMS messages (code)
Homework:
- Confirm that you have TextBlob installed by running
import textblob
from within your preferred Python environment. If it's not installed, runpip install textblob
at the command line (not from within Python). - Complete the Yelp review text homework, and add a Python script (or IPython notebook) to your GitHub repo. This assignment is due on Monday.
- There is a video/reading assignment on cross-validation, for those of you that have not already watched the video or would prefer a reading instead.
Resources:
- For more on conditional probability, read these slides, or read section 2.2 of the OpenIntro Statistics textbook (14 pages).
- For an intuitive explanation of Naive Bayes classification, read this post on airport security.
- For more details on Naive Bayes classification, Wikipedia has two excellent articles (Naive Bayes classifier and Naive Bayes spam filtering), and Cross Validated has a good Q&A.
- When applying Naive Bayes classification to a dataset with continuous features, it is best to use GaussianNB rather than MultinomialNB. Wikipedia has a short description of Gaussian Naive Bayes, as well as an excellent example of its usage.
- These slides from the University of Maryland provide more mathematical details on both logistic regression and Naive Bayes, and also explain how Naive Bayes is actually a "special case" of logistic regression.
- Andrew Ng has a paper comparing the performance of logistic regression and Naive Bayes across a variety of datasets.
- If you enjoyed Paul Graham's article, you can read his follow-up article on how he improved his spam filter and this related paper about state-of-the-art spam filtering in 2004.
- Yelp review text homework due (solution)
- Natural language processing (notebook, notebook code)
- Cross-validation
- Discuss the video/reading assignment (notebook, notebook code)
- Introduction to our Kaggle competition
- Create a Kaggle account, join the competition using the invitation link, download the sample submission, and then submit the sample submission (which will require SMS account verification).
Homework:
- Download the competition files, move them to the
DAT7/data
directory, and make sure you can open the CSV files using Pandas. If you have any problems opening the files, you probably need to turn off real-time virus scanning (especially Microsoft Security Essentials). - Come up with some theories about which features might be relevant to predicting the response, and then explore the data to see if those theories appear to be true.
- Optional: Think about some features that might be worth creating from the data, and then figure out how to actually create those features.
- Optional: Watch my project presentation video (16 minutes) for a tour of the end-to-end machine learning process for a Kaggle competition, including the creation of new features. (Or, just read through the slides.)
NLP Resources:
- If you want to learn a lot more NLP, check out the excellent video lectures and slides from this Coursera course (which is no longer being offered).
- This slide deck defines many of the key NLP terms.
- Natural Language Processing with Python is the most popular book for going in-depth with the Natural Language Toolkit (NLTK).
- A Smattering of NLP in Python provides a nice overview of NLTK, as does this notebook from DAT5.
- spaCy is a newer Python library for text processing that is focused on performance (unlike NLTK).
- If you want to get serious about NLP, Stanford CoreNLP is a suite of tools (written in Java) that is highly regarded.
- DC Natural Language Processing is an active Meetup group in our local area.
Cross-Validation Resources:
- For more on cross-validation, read section 5.1 of An Introduction to Statistical Learning (11 pages) or watch the related videos: K-fold and leave-one-out cross-validation (14 minutes), cross-validation the right and wrong ways (10 minutes).
- Accurately Measuring Model Prediction Error compares adjusted R-squared, AIC and BIC, train/test split, and cross-validation.
- If you want to understand the different variations of cross-validation, this paper examines and compares them in detail.
- Overview of how Kaggle works (slides)
- Kaggle In-Class competition: Predict whether a Stack Overflow question will be closed
- Complete code file
- Minimal code file: excludes all exploratory code
- Explanations of log loss
Homework:
- Your draft paper is due on Monday! Please submit a link to your project repository (with paper, code, data, and visualizations) before class using the submission form.
- Optional: Keep working on this competition! You can make up to 5 submissions per day, and the competition doesn't close until 6:30pm ET on Wednesday, August 5 (class 20).
Resources:
- For a great overview of the diversity of problems tackled by Kaggle competitions, watch Kaggle Transforms Data Science Into Competitive Sport (28 minutes) by Jeremy Howard (past president of Kaggle).
- Getting in Shape for the Sport of Data Science (74 minutes), also by Jeremy Howard, contains a lot of tips for competitive machine learning.
- Learning from the best is an excellent blog post covering top tips from Kaggle Masters on how to do well on Kaggle.
- Feature Engineering Without Domain Expertise (17 minutes), a talk by Kaggle Master Nick Kridler, provides some simple advice about how to iterate quickly and where to spend your time during a Kaggle competition.
- These examples may help you to better understand the process of feature engineering: predicting the number of passengers at a train station, identifying fraudulent users of an online store, identifying bots in an online auction, predicting who will subscribe to the next season of an orchestra, and evaluating the quality of e-commerce search engine results.
- Decision trees (notebook, notebook code)
Homework:
- You will be assigned to review the project drafts of two of your peers. You have until next Monday to provide them with feedback, according to the peer review guidelines.
- Read the "Wisdom of the crowds" section from MLWave's post on Human Ensemble Learning.
- Optional: Read the abstract from Do We Need Hundreds of Classifiers to Solve Real World Classification Problems?, as well as Kaggle CTO Ben Hamner's comment about the paper, paying attention to the mentions of "Random Forests".
Resources:
- scikit-learn's documentation on decision trees includes a nice overview of trees as well as tips for proper usage.
- For a more thorough introduction to decision trees, read section 4.3 (23 pages) of Introduction to Data Mining. (Chapter 4 is available as a free download.)
- This paper, The Science of Singing Along, contains a neat regression tree for predicting the percentage of an audience at a music venue that will sing along to a pop song.
- If you want to go deep into the different decision tree algorithms, this slide deck contains A Brief History of Classification and Regression Trees.
Installing GraphViz (optional):
- Mac: Download and install PKG file
- Windows: Download and install MSI file, and then add GraphViz to your path:
- Go to Control Panel, System, Advanced System Settings, Environment Variables
- Under system variables, edit "Path" to include the path to the "bin" folder, such as:
C:\Program Files (x86)\Graphviz2.38\bin
- Finish decision trees lesson
- Ensembling (notebook, notebook code)
Resources:
- scikit-learn's documentation on ensemble methods covers both "averaging methods" (such as bagging and Random Forests) as well as "boosting methods" (such as AdaBoost and Gradient Tree Boosting).
- For an intuitive explanation of Random Forests, read Edwin Chen's answer to How do random forests work in layman's terms?
- MLWave's Kaggle Ensembling Guide is very thorough and shows the many different ways that ensembling can take place.
- Browse the excellent solution paper from the winner of Kaggle's CrowdFlower competition for an example of the work and insight required to win a Kaggle competition.
- Interpretable vs Powerful Predictive Models: Why We Need Them Both is a short post on how the tactics useful in a Kaggle competition are not always useful in the real world.
- Advanced scikit-learn (code)
- GridSearchCV: searching for optimal parameters (exercise)
- StandardScaler: standardization of features
- Pipeline: chaining steps
- Clustering (slides, code)
- K-means: visualization
- DBSCAN: visualization
Homework:
- Optional: Read this classic paper, which may help you to connect many of the topics we have studied throughout the course: A Few Useful Things to Know about Machine Learning.
scikit-learn Resources:
- For a recap of today's lesson on GridSearchCV, plus a comparison with RandomizedSearchCV, watch How to find the best model parameters in scikit-learn (28 minutes) or read through the companion notebook.
- Here is a longer example of feature scaling in scikit-learn, with additional discussion of the types of scaling you can use.
- Practical Data Science in Python is a long and well-written notebook that includes the use of scikit-learn's Pipeline.
- scikit-learn has an incredibly active mailing list that is often much more useful than Stack Overflow for researching a particular function.
Clustering Resources:
- scikit-learn's documentation on clustering compares many different types of clustering.
- For a very thorough introduction to clustering, read chapter 8 (69 pages) of Introduction to Data Mining (available as a free download), or browse through the chapter 8 slides.
- An Introduction to Statistical Learning has useful videos on K-means clustering (17 minutes) and hierarchical clustering (15 minutes).
- Fun examples of clustering: A Statistical Analysis of the Work of Bob Ross (with data and Python code), How a Math Genius Hacked OkCupid to Find True Love, and characteristics of your zip code.
Homework:
- Your final project is due next week!
Resources:
- scikit-learn's machine learning map may help you to choose the "best" model for your task.
- Choosing a Machine Learning Classifier provides a short and highly readable comparison of several classification models, whereas Supervised learning superstitions cheat sheet is a much more thorough comparison (with links to lots of useful resources).
- Machine Learning Done Wrong, Clever Methods of Overfitting, and Common Pitfalls in Machine Learning all offer thoughtful advice on how to avoid common mistakes in machine learning.
- Practical machine learning tricks from the KDD 2011 best industry paper includes slightly more advanced advice than the resources above.
- An Empirical Comparison of Supervised Learning Algorithms is a readable research paper from 2006.
- Project presentations!
- What's next?
- This GA slide deck provides a brief introduction to databases and SQL. The Python script from that lesson demonstrates basic SQL queries, as well as how to connect to a SQLite database from Python and how to query it using Pandas.
- The repository for this SQL Bootcamp contains an extremely well-commented SQL script that is suitable for walking through on your own.
- This GA notebook provides a shorter introduction to databases and SQL that helpfully contrasts SQL queries with Pandas syntax.
- SQLZOO, Mode Analytics, and Code School all have online beginner SQL tutorials that look promising. Code School also offers an advanced tutorial, though it's not free.
- w3schools has a sample database that allows you to practice SQL from your browser. Similarly, Kaggle allows you to query a large SQLite database of Reddit Comments using their online "Scripts" application.
- What Every Data Scientist Needs to Know about SQL is a brief series of posts about SQL basics, and Introduction to SQL for Data Scientists is a paper with similar goals.
- 10 Easy Steps to a Complete Understanding of SQL is a good article for those who have some SQL experience and want to understand it at a deeper level.
- SQLite's article on Query Planning explains how SQL queries "work".
- A Comparison Of Relational Database Management Systems gives the pros and cons of SQLite, MySQL, and PostgreSQL.
- If you want to go deeper into databases and SQL, Stanford has a well-respected series of 14 mini-courses.
- Blaze is a Python package enabling you to use Pandas-like syntax to query data living in a variety of data storage systems.
- Good Data Management Practices for Data Analysis briefly summarizes the principles of "tidy data".
- Hadley Wickham's paper explains tidy data in detail and includes lots of good examples.
- Example of a tidy dataset: Bob Ross
- Examples of untidy datasets: NFL ticket prices, airline safety, Jets ticket prices, Chipotle orders
- If your co-workers tend to create spreadsheets that are unreadable by computers, they may benefit from reading these tips for releasing data in spreadsheets. (There are some additional suggestions in this answer from Cross Validated.)
- RegexOne is an interactive tutorial for learning the basics of regular expressions.
- Google's Python Class includes an excellent introductory lesson on regular expressions (which also has an associated video).
- Python for Informatics has a nice chapter on regular expressions. (If you want to run the examples, you'll need to download mbox.txt and mbox-short.txt.)
- My reference guide to regular expressions includes lots of short explanations and simple examples.
- regex101 is an online tool for testing your regular expressions in real time.
- If you want to go really deep with regular expressions, RexEgg includes endless articles and tutorials.
- Exploring Expressions of Emotions in GitHub Commit Messages is a fun example of how regular expressions can be used for data analysis, and Emojineering explains how Instagram uses regular expressions to detect emoji in hashtags.
- This GA notebook provides an introduction to regularization for linear models. The Python script from that lesson demonstrates ridge regression, lasso regression, and regularized logistic regression.
- This notebook from chapter 7 of Building Machine Learning Systems with Python has a nice long example of regularized linear regression.
- The scikit-learn user guide for Generalized Linear Models explains the different variations of regularization.
- Section 6.2 of An Introduction to Statistical Learning (14 pages) introduces both ridge regression and lasso regression. Or, watch the related videos on ridge regression (13 minutes) and lasso regression (15 minutes).
- Caltech's Learning From Data course has a great video introducing regularization (8 minutes) that builds upon their video about the bias-variance tradeoff.
- For a math-ier explanation of regularization, watch the last four videos (30 minutes) from week 3 of Andrew Ng's machine learning course, or read the related lecture notes compiled by a student.
- There are some special considerations when using dummy encoding for categorical features with a regularized model. This Cross Validated Q&A debates whether the dummy variables should be standardized (along with the rest of the features), and a comment on this blog post recommends that the baseline level should not be dropped.
- This GA slide deck provides a brief introduction to recommendation systems, and the Python script from that lesson demonstrates how to build a simple recommender.
- Chapter 9 of Mining of Massive Datasets (36 pages) is a more thorough introduction to recommendation systems.
- Chapters 2 through 4 of A Programmer's Guide to Data Mining (165 pages) provides a friendlier introduction, with lots of Python code and exercises.
- The Netflix Prize was the famous competition for improving Netflix's recommendation system by 10%. Here are some useful articles about the Netflix Prize:
- Netflix Recommendations: Beyond the 5 stars: Two posts from the Netflix blog summarizing the competition and their recommendation system
- Winning the Netflix Prize: A Summary: Overview of the models and techniques that went into the winning solution
- A Perspective on the Netflix Prize: A summary of the competition by the winning team
- This paper summarizes how Amazon.com's recommendation system works, and this Stack Overflow Q&A has some additional thoughts.
- Facebook and Etsy have blog posts about how their recommendation systems work.
- The Global Network of Discovery provides some neat recommenders for music, authors, and movies.
- The People Inside Your Machine (23 minutes) is a Planet Money podcast episode about how Amazon Mechanical Turks can assist with recommendation engines (and machine learning in general).
- Coursera has a course on recommendation systems, if you want to go even deeper into the material.