Advanced Computational Communication Methods (Summer 2023)

= Course Information =
 * COM 682: Advanced Computational Communication Methods
 * Location: Discord
 * Class Hours: Tuesdays, 10–12 ET in the #General channel on Matrix

Instructor

 * Instructor: Jeremy Foote
 * Email: jdfoote@purdue.edu
 * Office Hours: By appointment

= Course Overview and Learning Objectives =

I teach an Intro to Programming and Data Science course that gives students an introduction to programming in Python, and some basic skills for gathering and analyzing data from the web.

There are many, many aspects of computational communication research that we don't cover in that class. This class is intended to take the next step in providing resources for students who want to do computational social science research.

That next step typically looks different for different students, depending on what they want to research. One goal of this class is to collect useful resources for learning many of the types of tools and methods that computational social scientists typically use. Some of these will be explicitly discussed in class, but others will not.

In particular, following conversation with group members, we will focus on a fairly deep dive into computational text analysis and reproducible workflows. Other topics will be more self-organized and self-directed.

I will consider this class a complete success if, at the end, every student can:


 * Understand in and engage in creating open, reproducible workflows for their academic research
 * Understand some of the key tools for doing computational text analysis, including topic models, word embeddings, machine learning classifiers, and LLMs
 * Learn how to identify the key texts, software libraries, and resources for learning a new computational method

= Required resources and texts =

Laptop
Most of this class will be asynchronous, so you will need access to your own laptop. It is assumed that you have experience running Python programs on your computer, and have the needed hardware and software to do so. We will mostly be using Jupyter Notebooks, but you are welcome to use other IDEs.

In order to participate in class, you will need to sign up for our Matrix "space", using this link. If you haven't used Matrix before (most people haven't), then you will need to create an account and choose software to use to connect to the room. The default software is Element, which I highly recommend using. There is a web version of Element, but I'd recommend downloading desktop and mobile apps at https://element.io/download.

Readings

 * We will be working together to identify readings, videos, and other resources

= Course logistics =

Note About This Syllabus
This is a very collaborative class, and one of the outcomes of the class will be to update this wiki with resources regarding topics of interest to class members. Therefore, the syllabus will be in flux both before the class and during the class.

Lectures
Our class time will follow a "flipped" classroom model. We will identify asynchronous materials (readings, recorded lectures, assignments, etc.) which you will work on before class and we will use our class time to review concepts, identify confusion, and synthesize.

Because we only have a few hours a week, some of this work will also happen outside of class, through conversations in the Matrix space.

For the first ~half of class we will all be working on the same topics. For the second half, we will use part of class time for students to present on either a topic or a project that they are working on.

Office hours and email

 * I will be traveling for much of June and part of July. I'm happy to make time to meet, but my schedule will be much less consistent than during a typical semester.
 * I am also available by email. You can reach me at [mailto:jdfoote@purdue.edu jdfoote@purdue.edu].

= Assignments =

There will be two primary assignments for this class: one topic exploration, and a final project.

Topic exploration
One goal of this class is to learn to identify and assess tools, libraries, and learning resources. Each student will identify a topic that they would like to be in charge of. This will involve researching the conceptual background of the topic, identify and evaluating resources related to the topic, and sharing the best resources on this wiki page.

Ideally, this will include at least:
 * one or more academic papers about the topic
 * one or more Python libraries
 * one or more walkthroughs of using the method in Python (text and/or video)

Final Project
The final project can take one of two forms: either an explainer of a computational method or a research project.

Explainer
For the explainer, you will create a polished explainer of one of the topics covered in class. This should include an explanation of the topic/method, with a focus on how and why the topic is useful for doing social science research, as well as its limitations. You should also include an explanation of how to use the associated method, probably using public data.

Ideally, this explainer will fill a gap in the resources that already exist about a topic. One gap that often exists is resources specifically designed for communication scholars or social scientists more broadly. Or, resources to help more novice programmers, etc.

The format of this explainer is up to you, but it will likely at least include a Jupyter Notebook (or similar); I think that a video walkthrough of a notebook is also nice, but I'm open to other options.

Research Project
The other option for a final project is to push forward one of your quantitative research projects that would benefit from one or more computational methods. I strongly urge you to work on a project that will further your academic career outside of the class. There are many ways that this can happen. Some obvious options are to prepare a project that you can submit for publication, that you can use as pilot analysis that you can report in a grant or thesis proposal, and/or that fulfills a degree requirement. I prefer that you do projects on your own but it may be possible to work as a small team (maximum 3 people). Team projects are expected to be more ambitious than individual projects.

Planning Document
If you would like to take this option, you will submit a 2-4 page planning document of what you would like to do within the first few weeks of class, just to make sure we are on the same page about the scope of what you want to accomplish and so that I can give some initial feedback.

The project planning document is a basic shell/outline of an empirical quantitative research paper. The planning document should focus around three big questions:
 * Why are you planning to do this analysis? Make sure to introduce any background information about the topic, the community, your business, or anything else that will be required to properly contextualize your study.
 * How will you get the data to analyze? Describe the data sources will you collect and how they will be collected.
 * How will you analyze the data? Describe the visualizations, tables, or statistical tests that you will produce.

One approach that I have found helpful is outlined on this wiki page.

Project report
Final projects will likely look different, depending on the stage of the project when beginning the class. Typically, you will write a document or a Jupyter Notebook that will ideally provide the foundation for a high quality short research paper that you might revise and submit for publication. I do not expect the report to be ready for publication, but it should contain polished drafts of all the necessary components of a scholarly quantitative empirical research study. In terms of the structure, please see the page on the structure of a quantitative empirical research paper.

The great thing about a Jupyter Notebook is that it allows you to provide data, code, and any documentation sufficient to enable the replication of all analysis and visualizations. If you choose to write the report as a Word document, then you will need to include the code in a separate file.

Because the emphasis in this class is on methods and because I'm not an expert in each of your fields, I'm happy to assume that your paper, proposal, or thesis chapter has already established the relevance and significance of your study and has a comprehensive literature review, well-grounded conceptual approach, and compelling reason why this research is important. As a result, you do not need to focus on these elements of the work in your written submission. Instead, feel free to start with a brief summary of the purpose and importance of this research followed by an introduction of your research questions or hypotheses. If you provide more detail, that's fine, but I won't give you detailed feedback on these parts and they will not figure prominently in my assessment of the work.

Jupyter Notebooks do not have all of the tools for citations that Word or LaTeX or even Google Docs have, so while I expect you to cite related work your references section does not need to be as polished as citation management software would make it.

= Grades =

This course will follow a "self-assessment" philosophy. I am more interested in helping you to learn things that will be useful to you than in assigning grades. The university still requires grades, so you will be leading the evaluation of your work. At the beginning of the course, I will encourage you to think about and write down what you hope to get out of the course. Halfway throughthe course you will reflect on what you have accomplished thus far, how it has met, not met, or exceeded expectations, based both on rubrics and personal goals and objectives. At each of these stages you will receive feedback on your assessments. By the end of the semester, you should have a clear vision of your accomplishments and growth, which you will turn into a grade. As the instructor-of-record, I maintain the right to disagree with your assessment and alter grades as I see fit, but any time that I do this it will be accompanied by an explanation and discussion. These personal assessments, reflecting both honest and meaningful reflection of your work will be the most important factor in final grades.

I suggest that we use the following rubric in our assessment:


 * 30%: class participation, including attendance, participation in discussions and group work
 * 30%: topic exploration
 * 40%: Final Project paper/Jupyter notebook.

My interpretation of grade levels (A, B, C, D/F) is the following:

A: Reflects work the exceeds expectations on multiple fronts and to a great degree. Students reaching this level of achievement will:
 * Do what it takes to learn the programming principles and techniques, including looking to outside sources if necessary.
 * Engage thoughtfully with an ambitious final project.
 * Take intellectual risks, offering interpretations based on synthesizing material and asking for feedback from peers.
 * Share work early allowing extra time for engagement with others.

B: Reflects strong work. Work at this level will be of consistently high quality. Students reaching this level of achievement will:
 * Be more safe or consistent than the work described above.
 * Ask meaningful questions of peers and engage them in fruitful discussion.
 * Exceed requirements, but in fairly straightforward ways
 * Compose complete and sufficiently detailed reflections.
 * Complete nearly all of the programming assignments at a high level

C: This reflects meeting the minimum expectations of the course. Students reaching this level of achievement will:
 * Turn in and complete required assignments on time.
 * Be collegial and continue discussion, through asking simple or limited questions.
 * Not complete assignments or turn some in in a hasty or incomplete manner.

D/F: These are reserved for cases in which students do not complete work or participate. Students may also be impeding the ability of others to learn.

= Schedule =

NOTE: This section will be modified throughout the course to meet the class's needs. Check back in often.

Each week will include the topic of the week. This is where we will gather and organize resources regarding each topic. Please be bold in editing this portion of the wiki to add or arrange resources.

Week 1: Welcome! (May 16)
Assignment Due:
 * None

Required Readings:

Agenda:
 * Class overview and expectations — We'll walk through this syllabus.
 * Make assignments for topic exploration

Slides:

Welcome slides

Week 2: Reproducible Research I (May 23)
Resources:


 * Paper: Wilson G, Bryan J, Cranston K, Kitzes J, Nederbragt L, Teal TK (2017). Good enough practices in scientific computing. PLoS Comput Biol 13(6): e1005510.
 * Paper: Gentzkow M, Shapiro JM. Code and Data for the Social Sciences: A Practitioner's Guide; 2014. https://web.stanford.edu/~gentzkow/research/CodeAndData.pdf.
 * Video: Reproducible Research: Concepts and Ideas. Roger Peng. YouTube

Slides:
 * Week 2 and 3 slides
 * Video of class meeting

Organization
Key ideas: my_cool_project
 * Folder structure
 * Different options, but separate code from data
 * Jeremy's approach:
 * -- README.md # Explanation of project and how to navigate it
 * -- Snakefile # Or Makefile - workflow tool
 * -- data/
 * |-- raw_data/
 * |-- processed_data/
 * -- code/
 * -- results/
 * |-- figures/
 * -- papers/
 * -- presentations/
 * -- results/
 * |-- figures/
 * -- papers/
 * -- presentations/
 * -- presentations/
 * -- presentations/

Data Management
Key ideas:
 * Back up raw data
 * Keep raw data (and make it read-only)
 * Step one is to clean the data: create the data you wish you received
 * Name variables well
 * Use a tidy data structure
 * Share data (when possible)

Code management
Key ideas:
 * Version control
 * Don't repeat yourself (DRY)
 * Build at least a few high-level test cases

Week 3: Reproducible Research II (May 30)
Resources:
 * Blog post: Reproducible Workflows by Justin Kitzes
 * Introduction to Snakemake Tutorial (video)
 * An Introduction to Snakemake for social science
 * LaTeX introduction (video)
 * knitr introduction

Slides:


 * Week 2 and 3 slides
 * Video of class meeting

Reproducible analyses and papers
Key ideas:
 * Some big benefits (and some drawbacks) to using text-based tools (Markdown or LaTeX)
 * Can be put in version control
 * Tools like knitr can be used to put code directly into a document
 * Make figure creation part of your workflow, have documents point to your figures directory
 * Use citation management software that integrates with your document (use Zotero)

Sharing
Key ideas:
 * Share your code and data whenever possible!
 * Lots of options - OSF.io, Harvard Dataverse, etc.
 * Share preprints online

Advanced: Workflow Management
Key ideas:
 * Tools to reproduce as much of the workflow as possible
 * README file is much better than nothing
 * Even better is a "wrapper" script that runs everything
 * Very clear exactly what is run and how
 * Some fairly simple options:
 * Python file
 * GNU Make
 * Snakemake

Week 4: Computational text analysis: Introduction and Key Concepts (June 6)
Resources: Text As Data: A New Framework for Machine Learning and the Social Sciences (2022). Justin Grimmer, Margaret E. Roberts, and Brandon M. Stewart.

Read chapters 1-7

Embeddings
Resources:
 * Getting started with embeddings (Huggingface)

Semantic networks

 * NLP Tutorial Playlist Python (YouTube videos)

Week 6: Computational text analysis: using LLMs for research (June 20)
Due:
 * Final project proposal (details on Brightspace)

Resources:

Intro to LLMs:
 * Mark Riedl. A very gentle introduction to Large Language Models without the hype
 * How ChatGPT Works Technically | ChatGPT Architecture (YouTube)
 * Transformer Models: An introduction and catalog
 * What are Large Language Models (LLMs)?

Reflections on LLMs for research:
 * Ziems, C., Held, W., Shaikh, O., Chen, J., Zhang, Z., & Yang, D. (2023). Can Large Language Models Transform Computational Social Science?. arXiv preprint arXiv:2305.03514.

Papers using LLMs:
 * Park, J. S., O'Brien, J. C., Cai, C. J., Morris, M. R., Liang, P., & Bernstein, M. S. (2023). Generative agents: Interactive simulacra of human behavior. arXiv preprint arXiv:2304.03442.

Week 7: Share and discuss works-in-progress (June 27)
Assignment Due: self-assessment reflection

Topic Presentations:
 * Juan Pablo (JP) Loaiza-Ramírez

Work-in-progress Presentations:
 * Juan Pablo (JP) Loaiza-Ramírez
 * Christina Walker

Week 9: Share and discuss works-in-progress (July 11)
Topic Presentations:
 * Elizabeth Thompson
 * Ryan Funkhouser

Work-in-progress Presentations:
 * Dyuti Jha

Week 10: Share and discuss works-in-progress (July 18)
Topic Presentations:
 * Christina Walker
 * Hazel Chiu

Work-in-progress Presentations:
 * Elizabeth Thompson
 * Muqing Liu

Week 11: Share and discuss works-in-progress (July 25)
Visit from Bill Rand, an expert in agent-based moedeling.

Topic Presentations:
 * Dyuti Jha

Work-in-progress Presentations:
 * Hazel Chiu

Week 12: Share and discuss works-in-progress (August 1)
Topic Presentations:
 * Muqing Liu

Work-in-progress Presentations:
 * Ryan Funkhouser

Assignment Due:
 * Final project due

= Additional Topics =

This is a key goal of this page - a curated collection of resources around computational social science topics. I'll start with a list of topics, but please add others.

Participants

 * Ryan Funkhouser

Advanced Pandas
Christina (I think this is where you want me to sign up? - lol)

Agent-based modeling
Resources added by Juan Pablo (JP) Loaiza-Ramírez

The following resources are listed in order of importance. Consider them as a "gentle" introduction to agent-based modeling.

Best papers overall


 * Rand, W., & Rust, R. T. (2011). Agent-based modeling in marketing: Guidelines for rigor. International Journal of Research in Marketing, 28(3), 181–193. https://doi.org/10.1016/j.ijresmar.2011.04.002


 * Smith, E. B., & Rand, W. (2018). Simulating macro-level effects from micro-level observations. Management Science, 64(11), 5405–5421. https://doi.org/10.1287/mnsc.2017.2877


 * Waldherr, A., Hilbert, M., & González-Bailón, S. (2021). Worlds of agents: Prospects of agent-based modeling for communication research. Communication Methods and Measures, 15(4), 243–254. https://doi.org/10.1080/19312458.2021.1986478


 * Waldherr, A., & Wettstein, M. (2019). Bridging the gaps: Using agent-based modeling to reconcile data and theory in computational communication science. International Journal of Communication, 13, 3976–3999. https://ijoc.org/index.php/ijoc/article/view/10588

Seminal papers


 * Arthur, W. B. (1994). Inductive Reasoning and Bounded Rationality. The American Economic Review, 84(2), 406–411. http://www.jstor.org/stable/2117868


 * Axelrod, R. (1997). Advancing the art of simulation in the social sciences. Complexity, 3(2), 16–22. https://doi.org/10.1002/(SICI)1099-0526(199711/12)3:2<16::AID-CPLX4>3.0.CO;2-K


 * Axtell, R., Axelrod, R., Epstein, J. M., & Cohen, M. D. (1996). Aligning simulation models: A case study and results. In Computational and Mathematical Organization Theory (Vol. 1, Issue 2, pp. 123–141). Springer Science and Business Media LLC. https://doi.org/10.1007/bf01299065


 * Bonabeau, E. (2002). Agent-based modeling: Methods and techniques for simulating human systems. Proceedings of the National Academy of Sciences, 99, 7280–7287. https://doi.org/10.1073/pnas.082080899


 * Casti, J. L. (1996). Seeing the light at El Farol: A look at the most important problem in complex systems theory. Complexity, 1(5), 7–10. https://doi.org/10.1002/cplx.6130010503


 * Grimm, V., Berger, U., Bastiansen, F., Eliassen, S., Ginot, V., Giske, J., Goss-Custard, J., Grand, T., Heinz, S. K., Huse, G., Huth, A., Jepsen, J. U., Jørgensen, C., Mooij, W. M., Müller, B., Pe’er, G., Piou, C., Railsback, S. F., Robbins, A. M., … DeAngelis, D. L. (2006). A standard protocol for describing individual-based and agent-based models. Ecological Modelling, 198(1–2), 115–126. https://doi.org/10.1016/j.ecolmodel.2006.04.023


 * Schelling, T. C. (1969). Models of Segregation. The American Economic Review, 59(2), 488–493. http://www.jstor.org/stable/1823701

Examples of agent-based models in communication and other research fields


 * Foramitti, J. (2023). A framework for agent-based models of human needs and ecological limits. Ecological Economics, 204, 107651. https://doi.org/10.1016/j.ecolecon.2022.107651


 * Forero, D. S., Ceballos, Y. F., & Torres, G. S. (2019). Simulation of consumers decision-making process using agent-based model approach. International Journal of Modeling, Simulation, and Scientific Computing, 10(06), 1950037. https://doi.org/10.1142/S1793962319500375


 * Kato, J. S., & Sbicca, A. (2022). Bounded rationality, group formation and the emergence of trust: An agent-based economic model. Computational Economics, 60(2), 571–599. https://doi.org/10.1007/s10614-021-10158-x


 * Lopez Rodriguez, I., & Hernández Tejera, M. (2010). Agent-based services for building markets in distributed energy environments. Renewable Energy and Power Quality Journal, 1(08), 482–487. https://doi.org/10.24084/repqj08.367


 * Luan, S., Katsikopoulos, K. V., & Reimer, T. (2012). When does diversity trump ability (and vice versa) in group decision making? A simulation study. PLoS ONE, 7(2). https://doi.org/10.1371/journal.pone.0031043


 * Mittal, A., Krejci, C. C., Dorneich, M. C., & Fickes, D. (2019). An agent-based approach to modeling zero energy communities. Solar Energy, 191, 193–204. https://doi.org/10.1016/j.solener.2019.08.040


 * Sohn, D. (2022). Spiral of silence in the social media era: A simulation approach to the interplay between social networks and mass media. Communication Research, 49(1), 139–166. https://doi.org/10.1177/0093650219856510


 * Song, H., & Boomgaarden, H. G. (2017). Dynamic spirals put to test: An agent-based model of reinforcing spirals between selective exposure, interpersonal networks, and attitude polarization. Journal of Communication, 67(2), 256–281. https://doi.org/10.1111/jcom.12288

YouTube Playlists


 * KaVe 101 - Agent Based Modeling with Python


 * Agent-Based Modeling (NetLogo)

GitHub Repositories


 * Different frameworks for agent-based-modeling, including mesa, agentpy, among others


 * pyabm - Another agent-based modeling toolkit

Online courses


 * Agent-Based Modeling - Columbia University Irving Medical Center (General overview)


 * Simulation and modeling of natural processes - University of Geneva (Coursera)


 * Introduction to Agent-Based Modeling - Santa Fe Institute


 * 2022 Intro to Agent-Based Modeling Simulation AI in NetLogo - Udemy

Tutorials


 * Agent-Based Models with Python: An Introduction to Mesa - Santa Fe Institute

SQL
Muqing Liu

Building your own language model
Dyuti

Network analysis
Hazel
 * Network Analysis

Object-oriented programming

 * Classes and Object-oriented programming (This is a set of videos)

Screen scraping

 * Mini course on screen scraping

Regular expressions

 * Regular Expressions

= Administrative Notes =

Attendance Policy
Attendance is very important and it will be difficult to make up for any classes that are missed. It is expected that students communicate well in advance to faculty so that arrangements can be made for making up the work that was missed. It is the your responsibility to seek out support from classmates for notes, handouts, and other information.

Incomplete
A grade of incomplete (I) will be given only in unusual circumstances. The request must describe the circumstances, along with a proposed timeline for completing the course work. Submitting a request does not ensure that an incomplete grade will be granted. If granted, you will be required to fill out and sign an “Incomplete Contract” form that will be turned in with the course grades. Any requests made after the course is completed will not be considered for an incomplete grade.

Academic Integrity
While I encourage collaboration, I expect that any work that you submit is your own. Basic guidelines for Purdue students are outlined here but I expect you to be exemplary members of the academic community. Please get in touch if you have any questions or concerns.

Nondiscrimination
I strongly support Purdue's policy of nondiscrimination (below). If you feel like any member of our classroom--including me--is not living up to these principles, then please come and talk to me about it.

Purdue University is committed to maintaining a community which recognizes and values the inherent worth and dignity of every person; fosters tolerance, sensitivity, understanding, and mutual respect among its members; and encourages each individual to strive to reach his or her own potential. In pursuit of its goal of academic excellence, the University seeks to develop and nurture diversity. The University believes that diversity among its many members strengthens the institution, stimulates creativity, promotes the exchange of ideas, and enriches campus life.

Students with Disabilities
Purdue University strives to make learning experiences as accessible as possible. If you anticipate or experience physical or academic barriers based on disability, you are welcome to let me know so that we can discuss options. You are also encouraged to contact the Disability Resource Center at: drc@purdue.edu or by phone: 765-494-1247.

Emergency Preparation
In the event of a major campus emergency, I will update the requirements and deadlines as needed.

Mental Health
If you or someone you know is feeling overwhelmed, depressed, and/or in need of mental health support, services are available. For help, such individuals should contact Counseling and Psychological Services (CAPS) at 765-494-6995 during and after hours, on weekends and holidays, or by going to the CAPS office of the second floor of the Purdue University Student Health Center (PUSH) during business hours.

= Acknowledgements =

This course is heavily based on earlier courses taught by Tommy Guy and Mako Hill at the University of Washington as well as a course taught by Laura Nelson at Northeastern University.