14 Oct 2016
Presenter: John Marshall
Plan
I’m going to be presenting results and intended analyses from a working paper, which uses shocks to second-degree connections to estimate the effect of information passed from peer to peer. I intend to go through the method and some of the data issues involved (including construction of networks), as well as present the results and some of the ways we are thinking about (and difficulties of) robustness checks.
Link to Workshop Materials
07 Oct 2016
Presenter: Jeff Jacobs
Plan
Now that we have got our Python distribution installed, this week we will take a look at NetworkX, a Python library designed for easy creation, analysis, and visualization of network structures. Along the way we’ll learn more broadly useful Python “tricks” and data manipulation techniques, so hopefully you can get a lot out of it even if you never end up doing network analysis!
Setup Instructions
- Follow the setup instructions from last week, if you haven’t already
- Use the
pip
(or pip3
if you use python3
) utility to install networkx (pip install networkx
or pip3 install networkx
, respectively) and matplotlib (pip install matplotlib
or pip3 install matplotlib
) from your terminal.
- Download Gephi from https://gephi.org/
Link to Workshop Materials
All of the materials for this week are within this Dropbox folder. We will be going through NetworkX_Tutorial.pdf and examining/running/editing the code examples (basic_network.py
and country_network.py
) throughout.
23 Sep 2016
Presenter: Joe Sutherland
Link to the original post
Plan
It’s not always easy to let go, but in this case the reward far outweighs the risk! The purpose of this session is to introduce the ways in which Python supplants or supplements R in political science research. We will configure Python and Jupyter Notebook on your system, review package management, and collaborate to rewrite a commonly used R script in Python.
Setup Instructions
- Install Homebrew if you’re on a Mac, or Chocolatey if you’re on a PC by following the instructions at their homepages.
- Install the Python distribution. This will also install Python’s package manager,
pip
.
- Mac:
brew install python python3
.
- PC:
choco install python python3
(run as administrator).
- Use
pip
to install jupyter notebook.
- Mac:
pip install jupyter
.
- PC:
pip install jupyter
(run as administrator).
Booting Jupyter notebook
To boot the notebook, simply: jupyter notebook
(on PC it is sometimes jupyter notepad
) from the command line.
Link to Workshop Materials
- Github Repository with Materials (to get the materials on your computer you either need to install git and then
git clone https://github.com/jlsutherland/learn-to-love-python.git
in your command line, or simply download .zip file directly from github using clone or download button).
09 Sep 2016
Presenter: Abhit Bhandari
Plan
We’ll be looking at, among other things, how to efficiently integrate our R code (and the figures, tables, etc. we generate) and LaTeX when writing papers. We’ll be using Sublime Text 2 as our LaTeX editor, and I’ll be demonstrating some neat things you can do with it. Here are some links to things that you should have downloaded on your system before Friday’s seminar if you don’t have them already. If you have any problems, Gosha and I will be circulating at the beginning of the workshop on Friday to help people get all set up.
- Sublime Text version 2.0.2
- If you’re on a Mac, Skim PDF viewer. If on Windows, Sumatra PDF viewer
- The LaTeXTools plugin for Sublime Text. The plugin’s GitHub page has some very useful documentation. To install LaTeXTools, we’ll first need Package Control. Code and instructions for Package Control’s installation can be found on this page. We’ll also go over this at the beginning of the session in case there’s any confusion. In general, though, try to go through your OS-specific instructions (at the top of the GitHub documentation) beforehand.
Links to Workshop Materials:
02 Dec 2013
Presenter: Grant Gordon
Install R Packages:
- nnet, randomForest, e1071
Selected Background Papers:
- Murphy, Kevin P. 2012. Machine Learning: A Probabilistic Perspective. Cambridge, MA: The MIT Press.
- Read Chapter 1: Introduction
- Brieman, Leo. 2001. “Statistical Modeling: The Two Cultures.” Statistical Science. 16(3): 199-231.
- Hastie, Trevor and Robert Tibshirani and Jerome Friedman. 2008. “The Elements of Statistical Learning: Data Mining, Inference and Prediction.” New York, NY: Springer Series.
- Read Chapter 7: Model Assessment and Selection
- Read this
- Note: When you have time, read the rest of this book!
Applied Papers
Note: These papers feature two applications of machine learning to political science.
- Predicting Conflict
- Beck, Nathaniel, Gary King and Langsche Zeng. 2000. I”mproving Quantitative Studies of International Conflict: A conjecture.” The American Political Science Review. 94(1): 21-35.
- Ward, Michael D and Brian Greenhill and Kristin Bakke. 2010. “The Perils of Policy by P-value: Predicting Civil Conflicts” Journal of Peace Research. 47(4):363-375.
- Heterogeneous Treatment Effects
- Imai, Kosuke and Marc Ratkovic. 2013. “Estimating Treatment Effect Heterogeneity in Randomized Program Evaluation.” The Annals of Applied Statistics. 7(1): 443-470.
- Green, Donald P. and Holger L. Kern. 2012. “Modeling Heterogeneous Treatment Effects in Survey Experiments with Bayesian Additive Regression Trees.” Public Opinion Quarterly. 76: 491-511
Other Resources.
Note: Many of the leading professors in machine learning post their course lectures, problem sets (and answers, and code online). A few worth visiting are: