Skip to content

Latest commit

 

History

63 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Computational Methods for Social Science

Computational methods learned through projects and kept for later use in social science research.

Each project is a worked example of what a method does, where it may help, and what its limits are.

Purpose

This repository is:

  • a collection of reusable methods, not a portfolio of finished work;
  • a reference for choosing and adapting methods in later research;
  • a record of evaluation rules and known limits.

It is not a production library, a state-of-the-art benchmark, or a replication package for one paper.

Method index

Project Method Possible social science use Main artifact
Human activity recognition Time-series features, bootstrap intervals, logistic regression, L1 selection, Naive Bayes Turn sensor traces into behavior categories AReM-Analysis/MainAnalysis.ipynb
Movie-review sentiment Tokenization, embeddings, MLP, CNN, LSTM Turn text into attitude labels and compare model assumptions final_project/Final_project.ipynb
Sarcasm-aware sentiment TF-IDF baseline, BERT, predicted-irony signal Test how context affects text measurement EnhancedSentimentwithSarcasm/
Reinforcement learning State, action, reward, PPO Study sequential decisions and behavior simulation RL/README.md

In short: behavior traces → categories; text → attitudes; context → measurement correction; rewards → strategies.

The reinforcement-learning materials come from an external course and have not yet been adapted into a social science research example.

Research stance

  • Prediction is used as measurement, not as an explanation by itself.
  • Test performance is not causal evidence.
  • A more complex model does not automatically produce better social science.
  • Notebook results should be rerun before they are reported.

Quick start

Python 3.10 or 3.11 is recommended.

git clone https://github.com/yuyingzi/ComputationalMethods4SCResearch.git
cd ComputationalMethods4SCResearch

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

python scripts/validate_repo.py
jupyter lab

The integrity check is fast and does not train models. The BERT experiments download the IMDb dataset and pretrained weights on first use; a GPU is recommended.

Run the NLP scripts

cd EnhancedSentimentwithSarcasm
python LogisticRegPredi.py
python Pretrain.py
python EnhancedwithSarcasm_pretrain.py

Evaluation contract

  • Model and feature selection use training or validation data only.
  • Held-out test data is evaluated once and is never passed to fit().
  • Random splits, model initialization, and bootstrap estimates use fixed seeds.
  • Oversampling is applied only to final case-control fitting; it is not allowed to leak duplicated observations across cross-validation folds.
  • Notebook results should be regenerated before they are reported or cited.

Data and attribution

Data or material Use in this repository Source and attribution
AReM sensor data Human activity classification UCI AReM dataset, DOI 10.24432/C5SS33, licensed CC BY 4.0
Movie Review Polarity Dataset v2.0 Bundled positive/negative review archives in final_project/Data/ Cornell Movie Review Data; cite Pang and Lee (ACL 2004)
Large Movie Review Dataset (IMDb) Downloaded by the standalone sentiment scripts Stanford dataset page and stanfordnlp/imdb; cite Maas et al. (ACL 2011)
SemEval-2018 Task 3 Irony-detection training material Task paper; cite Van Hee, Lefever, and Hoste (SemEval 2018)
Huggy / Deep RL course Reinforcement-learning notebooks and exercises Hugging Face Deep RL Course

EnhancedSentimentwithSarcasm/combined_new_irony.csv also contains additional combined records whose exact provenance and redistribution terms are not fully documented. Treat it as course material only; do not publish it as a new dataset until that provenance is resolved.

Known limitations

  • Full BERT and TensorFlow runs are not part of the fast integrity check.
  • Fresh metrics are intentionally not committed in notebook outputs.
  • The projects do not yet share one experiment-tracking or reporting format.
  • The repository has no top-level license. Dataset licenses do not automatically grant a license for the code; the owner should choose one before inviting reuse or contributions.

Validation

python scripts/validate_repo.py
git diff --check

The first command checks Python syntax, notebook integrity, bundled archive counts, and the most important train/test-separation invariants.

About

this is a repository for me to explore how machine learning, NLP method etc. could integrate in social science/public communication research (mainly in Communication, Sociology and Social Psychology)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages